10 Dec 2012 4:52 AM #1
Answered: Grid Column Sorting Question
I've got an app where I'm loading data into a grid in a certain sort sequence based on different search fields the user can specify. This is done using the Order By on the sql when retrieving the data from the Db.
Once the data is loaded into the grid the user can re-sort the data by clicking on a column header.
My problem is this, if the user performs another search I want the sort to revert back to the sort sequence before they clicked on a grid column.
I assumed the headerCt.clearOtherSortStates(null , true); would do what I was looking for. This does clear graphic arrow on the column header that was clicked but when the grid's reloaded it still retains the sort sequence of the clicked column.
Any help would be appreciated
You need to clear the sorting on the store, the grid reflects the sorting on the store
12 Dec 2012 8:05 AM #2
- Join Date
- Mar 2007
- Gainesville, FL
- Vote Rating
You need to clear the sorting on the store, the grid reflects the sorting on the storeMitchell Simoens @LikelyMitch
Sencha Inc, Senior Software Engineer
Check out my GitHub, lots of nice things for Ext JS 4 and Sencha Touch 2
Think my support is good? Get more personalized support via a support subscription. https://www.sencha.com/store/
Need more help with your app? Hire Sencha Services email@example.com
Want to learn Sencha Touch 2? Check out Sencha Touch in Action that is in print!
When posting code, please use BBCode's CODE tags.
12 Dec 2012 9:23 AM #3
This is probably a stupid question but not sure how to clear the sorting on the store.
Within the store definition I don't specify any sort fields, the sql order by is controller the sequence of the data initially coming in.
I looked thru all the methods for a store & wasn't sure which 1 would clear the sorting.
13 Dec 2012 5:10 AM #4
Looks like I was over complicating things. All I had to do was add sortOnLoad : false in the store definition.