受限制的选择dGrid数据

时间:2015-09-03 14:02:54

标签: dojo selection rows dgrid

我有一个用dGrid创建的网格,带有“Pagination”扩展名,我需要点击dgrid标题上的check-all复选框,只选择当前页面中的行,而不检查其他页面的行! !!

这可能吗???

1 个答案:

答案 0 :(得分:0)

没有开箱即用。但是我在不同情况下有相同的要求,并为我的网格添加了一个新方法。

此代码将检查网格中所有可见的用户复选框。我认为它也适用于你的情况。将其添加到您的网格并调用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);
},