:: Forum >>

Problem Sorting Column with Numeric and Character Strings

I have a column which ends up holding both strings containing only numbers and strings consisting entirely of letters. When I attempt to sort this column, the order is not correct. I have created a small example which reproduces the problem.

Is there something that I can do to fix this?
Adam
Wednesday, November 3, 2004
What is not correct with the sort? You say you have an example but you didn't post a URL for it. We can't help you 'fix it' if we don't know what the problem is, even showing some text of the resulting sort would be a good start.
Jim Hunter
Friday, November 12, 2004
I have reproduced it using the values "111", "222", "col1" using a javascript array. When I sort the column the results are: "222", "col1", "111" in descending order and "111", "col1", "222" in ascending order.
ladykadyj
Friday, November 12, 2004
Actually, to follow up I have two columns with the same values and they sort differently. One sorts as I described above and the other sorts the same values (same rows) correctly: "111", "222", "col1" and vice versa. Interesting.
ladykadyj
Friday, November 12, 2004
I guess posting the question first to see if it was a known problem and waiting until someone asked for the example was a bad idea:).

You'll find that the initial sort returns 3,A,1,2,E,S

Here it is:

var myData = [
["1"],
["2"],
["3"],
["A"],
["E"],
["S"]
];

var myColumns = ["column"];

// create ActiveWidgets Grid javascript object
var obj = new Active.Controls.Grid;

// set number of rows/columns
obj.setRowProperty("count", 6);
obj.setColumnProperty("count", 1);

// provide cells and headers text
obj.setDataProperty("text", function(i, j){return myData[i][j]});
obj.setColumnProperty("text", function(i){return myColumns[i]});

// write grid html to the page
document.write(obj);
Adam
Monday, November 15, 2004
Hi,

Has anybody found the solution to this problem. I'm also experiencing this kind of bug. Hope anyone can help. Thanks!
Anselmo
Wednesday, February 22, 2006

This topic is archived.


Back to support forum

Forum search