ASP.net
Awesome
Learn
Forum
Buy
Demos
Sign In
☾
☀
Switch to
Dark
Light
Mode
this site works best with javascript enabled
Ask Question
Client Side API load sort, unable to rank
Title:
B
I
{code}
?
I wondered how to do a sort on load, and be able to rank the different columns. Using the client side API demo, I modified the sort to the following, but it does not sort by Date first. $('#ApiDemoGrid').data('api').load( { group: [], sort: [{ Prop: "Date", Sort: 2}, { Prop: "Food", Sort: 2}], params:{} }); Is it possible to add SortRank to it?
Save Changes
Cancel
Dan Lambourne
asked at 06 Jul 2015
You're right, that's how it works atm, from left to right, will get this fixed asap, Thank You for noticing
at 07 Jul 2015
Omu
new version has been released (4.7.3), please redownload and try again
at 17 Jul 2015
Omu
that worked, and with a little additional code I was able to add small numbers next to the arrows, to give a better indication of the order as you get with some grids.
at 21 Jul 2015
Dan Lambourne
if you need sort order, you can get it like this $('#Grid1').data('o').columns[colIndex].So , perhaps you can create a mod for your custom code, see awem.js
at 21 Jul 2015
Omu
I had the sort order saved away anyway to send to a chart, but your suggestion will cut down my code considerably, as I had one function per grid, but now I should be able to have one function that covers all grids. Many thanks.
at 21 Jul 2015
Dan Lambourne
Using .data('o').columns[colIndex].So it looks OK initially, as I have a two column sort with numbers 1 and 2. On adding a new sort by clicking a third header, I get a value of 101 rather than 3. If I clear all sort arrows, the numbers remain so I now have 1, 2 and 101. I then add back the arrow to 1, and it changed to 102. I can work around it by looping through the columns twice, once to add the numbers for those columns with sort arrows to an ordered list, then again to display the index of the column in the ordered list, but it does make the code untidy.
at 21 Jul 2015
Dan Lambourne
yes, that's how it works, and your solution should work, sort and display the index instead
at 21 Jul 2015
Omu
Answers
please
Sign In
to leave an answer
By accessing this site, you agree to store cookies on your device and disclose information in accordance with our
cookie policy
and
privacy policy
.
OK