PDA

View Full Version : Grid Sorting Isuue



AJAIN32
12 Mar 2015, 7:29 AM
Hi,

Can anyone please tell me what kind of sorting algorithm is used for Grid Sorting?

I have a situation where i am using a single store that has multiple records, and records are arranged in such a manner that some records are parent and some are child of one of the parent record.
Now when i want to perform sorting on grid - I want parent elements and child elements to be arranged properly, I tried by overriding doSort function but not able to write the correct logic that works in all scenario(for Assending and desending order sort).
For example i have one column data as

0
2500
1200 (child element)
0 (child element)
0 (child element)
1800

And i want to sort it in assending order that looks like -

0
1800
2500
0 (Child Elements)
0
1200

As the sorting algo works in extjs grid, i am not able to compare 1800 with 2500 in doSort function.

can anyone please suggest what can i do for that? Any Help would be appreciated.

Thanks,
Ankit

Gary Schlosberg
19 Mar 2015, 6:11 PM
Are you using associations?
http://docs.sencha.com/extjs/4.2.1/#!/api/Ext.data.association.Association

AJAIN32
19 Mar 2015, 7:50 PM
Hi,

Thanks For Replying !!

No, I am not using Association. because i am getting data from some other service and its in a single model. I am getting data in a single store that i need to sort the store based on the parent child levels.

can we make any composite key to sort that can make each record unique by maintaining the Parent -Child relationship as well.

Thanks,
Ankit