:: Forum >>

multipage grid -> empty rows sorting

does anyone has a multipage grid sorting correctly? empty cells break up sorting, but the script provided in the 'Known bugs' part of this site doesn't work...
Rekcor
Monday, October 9, 2006
Solution: replace the 'obj.sort'-part with:

obj.sort = function(index){
var i, count = this.getCount();
if (!this._sorted){
this._sorted = [];
for(i=0; i<count; i++){
this._sorted[i] = i;
}
}

var a = {}, direction = "ascending";
var rows = this._sorted;

if (this.$owner.getSortProperty("index") == index){
if (this.$owner.getSortProperty("direction") == "ascending") {direction = "descending"}
rows.reverse();
}
else {
for (i=0; i<rows.length; i++) {
var text = this.$owner.getDataProperty("value", rows[i], index);

var value = text;

a[rows[i]] = isNaN(value) ? text.toLowerCase() + " " : value;

}
rows.sort(function(x,y){return a[x] > a[y] ? 1 : (a[x] == a[y] ? 0 : -1)});
}

this._sorted = rows;

this._orders = [];
for(i=0; i<rows.length; i++){
this._orders[rows[i]] = i;
}

this._dataTypes=[]
for(i=0; i<10; i++){
this._dataTypes[i] = 'string';
}

this.setPageNumber(0);
this.$owner.setSortProperty("index", index);
this.$owner.setSortProperty("direction", direction);

}
Rekcor
Friday, October 13, 2006

This topic is archived.


Back to support forum

Forum search