View Full Version : Sorting of a Grid column
23 Jan 2012, 11:39 PM
I'm facing problem with sorting a particular column of a grid.The column looks like this:30935We should sort the order of appearance of the duty status as 'off-duty','Driving','sleeper'.
I have no clue on how to go about it .
Please help me.
24 Jan 2012, 1:31 AM
popping up the thread
Its urgent.. can you guys please reply if u know :(
24 Jan 2012, 2:15 AM
If sortable is not set to false on the grid column, you can sort the column by clicking on the column header. However, sorting will depend on the data in the grid i.e. how you render the image in the grid... If its plain text, sorting will work properly.
24 Jan 2012, 2:24 AM
I'm not sure if you understood what I had asked.
All the 'offDuty ' data should appear first followed by 'Driving' data followed by 'sleeper'.
As far as I know ,clicking on the column header would arrange it in ascending or descending order and othing more than that.Isn't it ?
24 Jan 2012, 3:23 AM
Ok. no I hadnt understood what you had asked for.
I dont know if there is a shortcut to do it but what you can do is to take a temporary array. On the load event of the store, use a for loop to loop over the records and add them to the array in the order you want according to this column. Then use store.loadData() to load that array. This might help you if you need a solution quickly and dont know any other way to do it.
24 Jan 2012, 3:32 AM
But I use JSON for data.
Any other solution ?
24 Jan 2012, 3:51 AM
24 Jan 2012, 5:01 AM
I will try to do that.
Powered by vBulletin® Version 4.1.5 Copyright © 2016 vBulletin Solutions, Inc. All rights reserved.