View Full Version : Sorting Numeric Text in Column

11 Jan 2011, 8:14 AM
Hey All,

Is there a way to sort numeric text in an appropriate fashion (and not like 10,109,21,240,3)?



13 Jan 2011, 5:48 AM
are you setting the field as type : 'INT" ?

13 Jan 2011, 5:59 AM
No...as a string...was kind of hoping there would be a way to handle this with a configuration option. I tried setting the sortType in the fields configuration object to 'asInt', but it had no effect.

13 Jan 2011, 6:04 AM
try this simple sorter:

function sortNumber(a,b) {
return b - a;

var n = ["10", "5", "40", "25", "100", "1"];

13 Jan 2011, 7:03 AM
Okay...where or how do I implement this sorter? I have a JsonStore with dates, alphanumeric data and numbers (all received as strings) that feeds a grid on a report page. I was able to get the dates to sort by setting the dateFormat property to "m/d/Y' within the JsonStore. Where or how do I configure this sorter to apply only to the number fields?