:: Forum >>

RE: Best way to do?

Yes, this is a bug :-(

Here is a patch for the sort function:

<script>

Active.Controls.Grid.patch = function(){

var obj = this.prototype;

obj.sort = function(index){
var a = {}, direction = "ascending";
var rows = this.getRowProperty("values");

if (this.getSortProperty("index") == index) {
if (this.getSortProperty("direction") == "ascending") {direction = "descending"}
rows.reverse();
}
else {
for (var i=0; i<rows.length; i++) {
var text = "" + this.getDataProperty("value", rows[i], index);
var value = Number(text.replace(/[ ,%$]/gi, "").replace(/((.*))/, "-$1"));
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.setRowProperty("values", rows);
this.setSortProperty("index", index);
this.setSortProperty("direction", direction);
};

};

Active.Controls.Grid.patch();

</script>
Alex (ActiveWidgets)
Monday, December 15, 2003

This topic is archived.


Back to support forum

Forum search