简体   繁体   English

Dojox.grid.datagrid排序顺序

[英]Dojox.grid.datagrid sorting order

我试图了解dojox.grid.Datagrid的排序行为,特别想知道一个多列网格,如果该列按2个(或更多)行具有相同单元格值的列进行排序,那么将决定它们的排序顺序出现在网格中?

The datagrid only use the selected column for sorting: 数据网格仅使用选定的列进行排序:

getSortProps: function(){
    var c = this.getCell(this.getSortIndex());
    if(!c){
        if(this.sortFields){
            return this.sortFields;
        }
        return null;
    }else{
        var desc = c["sortDesc"];
        var si = !(this.sortInfo>0);
        if(typeof desc == "undefined"){
            desc = si;
        }else{
            desc = si ? !desc : desc;
        }
        return [{ attribute: c.field, descending: desc }];
    }
}

So, when you have two rows with the sam cell value, the time of the row addition will descide the order. 因此,当您有两行具有sam单元格值的行时,添加行的时间将决定顺序。 (Which row is older, that will be in forward position). (哪一排是旧的,将处于前向位置)。

Otherwise, you can redefine the getSortProps method on your object, so you can add secondary sorting option. 否则,您可以在对象上重新定义getSortProps方法,因此可以添加辅助排序选项。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM