PDA

View Full Version : Sorting of numeric column in GridPanel



livinglegends
3 Dec 2010, 9:35 PM
Hi,

In my GridPanel, there is one column price. When I sort price column it should sort column according to numeric value.

But, it sort it by considering values as a String.

so, values are 3, 12, 1, 45, 32. So, after sorting it should be 1, 3, 12, 32 45 but it gives me 1, 12, 3, 32 45.

Any work around?

Condor
4 Dec 2010, 12:50 AM
You have to make sure your column actually contains Numbers.

You can do this by configuring your field with type:'int' (or 'float').

Animal
4 Dec 2010, 1:25 AM
Of course you don't even need to do that if the JSON which provided the raw data contains numeric constants. Type AUTO leaves them unchanged. The OP must be either using XML which IIRC, pulls in a string by default from the mapping, or if using JSON must be supplying strings.