dojo grid遇到的问题 点击按钮“全选”'删除"无法实现

想写个网格 在下面有两个按钮 分别实现全选 与 全不选的功能

界面如下:

其中关键语句 :<button dojoType="dijit.form.Button" onClick='dijit.byId("grid").rowSelectCell.toggleAllSelection(true)'>全选</button>

<button dojoType="dijit.form.Button" onClick='dijit.byId("grid").rowSelectCell.toggleAllSelection(false)'>删除</button>

似乎根本没有实现   不知道什么原因。。。

完全的代码如下:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html dir="ltr">
    
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
        <style type="text/css">
            body, html { font-family:helvetica,arial,sans-serif; font-size:90%; }
        </style>
         <script type="text/javascript" src="dojo/dojo.js" djConfig="isDebug:true","parseOnLoad: true"></script>
       
        <script type="text/javascript">
            dojo.require("dojox.grid.EnhancedGrid");
            dojo.require("dojox.grid.enhanced.plugins.DnD");
            dojo.require("dojox.grid.enhanced.plugins.Menu");
            dojo.require("dojox.grid.enhanced.plugins.NestedSorting");
            dojo.require("dojox.grid.enhanced.plugins.IndirectSelection");
            dojo.require("dojox.data.CsvStore");
            dojo.require('dijit.form.Button');
            dojo.require('dojo.parser');
            
            dojo.addOnLoad(function() {
                // our test data store for this example:
                var store = new dojox.data.CsvStore({
                    url: 'dojox/grid/compat/tests/support/movies.csv'
                });

                // set the layout structure:
                var layout = [{
                    field: 'Title',
                    name: '名字',
                    width: '200px'
                },
                {
                    field: 'Year',
                    name: '年份',
                    width: '50px'
                },
                {
                    field: 'Producer',
                    name: '时间',
                    width: 'auto'
                }];

                // create a new grid:
                var grid = new dojox.grid.EnhancedGrid({
                    query: {
                        Title: '*'
                    },
                    store: store,
                    rowSelector: '20px',
                    structure: layout,
                    plugins: {
                        nestedSorting: true,
                        dnd: true,
                        indirectSelection: {
                            name: "Selection",
                            width: "70px",
                            styles: "text-align: center;"
                        }
                    }
                },
                document.createElement('div'));

                // append the new grid to the div "gridContainer4":
                dojo.byId("gridDiv").appendChild(grid.domNode);

                // Call startup, in order to render the grid:
                grid.startup();
            });
        </script>
    
        <script type="dojo/method" event="onClick" >
           
        </script>

        
        <link rel="stylesheet" type="text/css" url="dijit/themes/claro/claro.css"
        />
        <style type="text/css">
            @import "dojo/resources/dojo.css";
            @import "dijit/themes/claro/claro.css";
            @import "dojox/grid/enhanced/resources/claro/EnhancedGrid.css";
            @import "dojox/grid/enhanced/resources/EnhancedGrid_rtl.css";
            .dojoxGrid table { margin: 0; } html, body { width: 70%; height: 70%;
            margin: 0; }
        </style>
    </head>
    
    <body class=" claro ">
        <div id="gridDiv" style="width: 100%; height: 100%;">
        </div>
        <!-- NOTE: the following script tag is not intended for usage in real
        world!! it is part of the CodeGlass and you should just remove it when
        you use the code -->
        <script type="text/javascript">
            dojo.addOnLoad(function() {
                if (document.pub) {
                    document.pub();
                }
            });
        </script>
         <br />
        <button dojoType="dijit.form.Button" onClick='dijit.byId("grid").rowSelectCell.toggleAllSelection(true)'>全选</button>
     &nbsp;&nbsp;
    <button dojoType="dijit.form.Button" onClick='dijit.byId("grid").rowSelectCell.toggleAllSelection(false)'>删除</button>
     &nbsp;&nbsp;

    </body>
    

</html>


希望明白什么地方不对的人能帮我改改。。。




  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 3
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 3
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值