DOJO-dojox.grid.EnhancedGrid(带刷新函数,分页工具栏,复选框,行号等功能) 转

dojo.require("dojox.grid.EnhancedGrid");
dojo.require("dojox.grid.enhanced.plugins.Pagination");
dojo.require("dojox.grid.cells");
dojo.require("dojox/grid/_CheckBoxSelector");
dojo.require("dojo.data.ItemFileWriteStore");

 

var grid = new dojox.grid.EnhancedGrid({

    jsid: "grid",
    style: 'width:300px',
    refresh: function(){
        var oThis = this;
        oThis.setStore(new dojo.data.ItemFileWriteStore({
            url: '这里写上你的请求地址ACTION,servlet,json文件等',
            handleAs: "json"
        }));
    },
    structure: [{
        type : "dojox.grid._CheckBoxSelector",
        width : 3
    },[    
        new dojox.grid.cells.RowIndex({width: 2, name:''}),
        {name: '列1, field: 'col1'},
        {name: '列2', field: 'col2'}
    ]],
    columnReordering: true,
    rowsPerPage: "20",
    plugins: {
      pagination: {
          //pageSizes: seit.gx.pageSize4Grid,
          pageSizes: [],
          description: true,
          sizeSwitch: true,
          pageStepper: true,
          gotoButton: true,
          maxPageStep: 4,
          position: "bottom"
      }
    },
    'onCellClick': function(e){
        alert(e.rowIndex);
    },

});

grid.refresh();

grid.set("onCellClick", function(e){//点击事件
    var item = grid.getItem(e.rowIndex);
        store = grid.store,
        name = store.getValue(item, "id"),
        datasourceCell= 3,//数据源
        collectCell= 4,//采集
        ri = e.rowIndex,//点击的行号
        ci = e.cellIndex,//点击的列号

        item = grid.getItem(ri);

});

 

posted @ 2014-07-02 16:02  Conkis  阅读(251)  评论(0编辑  收藏  举报