2

我有一个不想排序的网格(dojox.grid v1.2)。我怎样才能禁用它?

4

4 回答 4

4

找到了:

http://dojotoolkit.org/forum/dojox-dojox/dojox-grid-support/disable-sorting-specific-column-0

要保存链接:

在您的 onload 或 postrender 中添加如下代码:

dojo.byId('myGridId').canSort = function(col){ if(Math.abs(col) == 3) { return false; } else { return true; } };

(请注意,在此设置中,列似乎从 1 开始索引。)

于 2008-12-18T20:50:43.843 回答
0

如果您以编程方式创建网格,则可以执行以下操作:

var grid = new dojox.grid.DataGrid({ 
               ..., 
               canSort: function(col) { return col != 3; }
           });
于 2014-02-12T14:29:18.757 回答
0

使用属性canSort : false隐藏或禁用代码中的排序按钮Dojo DataGrid

var newGrid = new DataGrid({

        id : 'newGrid',

        canSort:false,

        store : this.resultStore,

        structure : this.resultGridLayout,

        autoHeight:true
});

问候,

Satish M Hiremath

于 2016-06-15T13:05:09.813 回答
0

我认为正确的解决方案是

dijit.byId('yourgridid').attr('canSort', function(col){

    if(Math.abs(col) == 3) {
      return false;
    } else {
       return true;
    }

});
于 2019-01-09T14:47:10.193 回答