我有一个用dGrid创建的网格,扩展名为"Pagination“,我需要点击dgrid标题上的check-all复选框,只选择当前页面中的行,而不选中其他页面的行!
这有可能吗?
发布于 2015-09-30 17:15:52
不是开箱即用的。但我在不同的情况下有相同的需求,并在我的网格中添加了一个新方法。
此代码将选中网格中所有对用户可见的复选框。我认为它在你的情况下也应该行得通。将此代码添加到您的网格中并调用grid.checkAll()
checkAll:function(){
this._selected = [];
this.clearSelection();
array.forEach(query("input[type=checkbox]",this.contentNode), function(input, i){
var isVisible = input.offsetWidth > 0 || input.offsetHeight > 0; //check if row checkbox is visible for user
if(isVisible){
var row = this.row(input.parentNode);
if (this._selected.indexOf(row) == -1){
this._selected.push(row);
}
input.checked = true;
input.setAttribute("aria-checked", true);
}
},this);
},https://stackoverflow.com/questions/32377839
复制相似问题