【发布时间】:2010-09-27 14:31:34
【问题描述】:
我有一个不想排序的网格 (dojox.grid v1.2)。我怎样才能禁用它?
【问题讨论】:
我有一个不想排序的网格 (dojox.grid v1.2)。我怎样才能禁用它?
【问题讨论】:
找到了:
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 开始索引。)
【讨论】:
如果您以编程方式创建网格,您可以执行以下操作:
var grid = new dojox.grid.DataGrid({
...,
canSort: function(col) { return col != 3; }
});
【讨论】:
使用属性canSort : false 隐藏或禁用Dojo DataGrid 代码中的排序按钮:
var newGrid = new DataGrid({
id : 'newGrid',
canSort:false,
store : this.resultStore,
structure : this.resultGridLayout,
autoHeight:true
});
问候,
Satish M Hiremath
【讨论】:
我认为正确的解决方案是
dijit.byId('yourgridid').attr('canSort', function(col){
if(Math.abs(col) == 3) {
return false;
} else {
return true;
}
});
【讨论】: