:: Forum >>

Data problem - trying to fix

Ok, I have an XML file.
It has in it at getData(0,i), something like "T01"
But I need it to be just "1"

I was triyng to do it this way:

table.request();
table.response1 = table.response;
table.response = function(xml) {
this.response1(xml);
var i, rowCount = this.getCount(), orgValue="";
for (i=0; i< rowCount; i++) {
orgValue = this.getData(0,i);
orgValue = orgValue.substring(1);
alert(orgValue);
this.setData(0, i) = orgValue;
}
}

The end return is that I need it to be a numerical value for sorting purposes (but I need to display it as "T01" ... mny probably is that now we can have "T101" - this throwing off the sorting ability.

Any ideas?
Carl
Monday, January 14, 2008
I think this could be better solved with custom format:

var fmt = new AW.System.Format;

// value (used for sorting)
fmt.dataToValue = function(data){
return Number(data.substring(1));
}

// display text
fmt.dataToText = function(data){
return data;
}

...

grid.setCellFormat(fmt, 0);
Alex (ActiveWidgets)
Thursday, January 17, 2008
awesome - thanks. Didn't think of that. Much appreciated Alex.
Carl
Thursday, January 17, 2008
Adding the above code worked Alex. One slight problem. The initial render of the grid still has them out of order. Clicking the column heading does re-order it correctly. Is there a way to have it sort it correctly BEFORE it is rendered? I've tried a number of things really quick ... but haven't gotten it to do it.
Carl
Thursday, January 17, 2008

This topic is archived.


Back to support forum

Forum search