[CLOSED] Reset store's sort info on grid reload/reconfigure
I have a gridpanel and a button on a page. On the button click, it will reload the gridpanel with new columns. The bug is that the store still keeps the original sortinfo. How can I reset the store's sortinfo to either nothing or one of the new columns when I am on the server? If I do store.sort("NewColumn", ASC), it will reload my data again.
RE: [CLOSED] Reset store's sort info on grid reload/reconfigure
I also tried setting the store's SortInfo on the server when I am loading the grid with new columns. I see that the script to set the sortinfo is emitted and but it doesn't highlight the column it is suppose to sort on. I also tried emitting "grid.getView().updateHeaderSortState()" but that didn't do anything. If I try to page the grid, I dont see the sort and dir as parameters in the request.
RE: [CLOSED] Reset store's sort info on grid reload/reconfigure
Hi,
Try the following store's method
setDefaultSort( <code style="font-style: normal; font-weight: normal; font-family: 'Lucida Console','Courier New',Courier,monospace; font-size: 12px;">String fieldName</code>, [<code style="font-style: normal; font-weight: normal; font-family: 'Lucida Console','Courier New',Courier,monospace; font-size: 12px;">String dir</code>] ) : void<div class="mdesc" style="margin: 0px; padding: 5px 0px; color: rgb(68, 68, 68);"><div class="long" style="margin: 0px; padding: 0px; display: block; line-height: 18px;">Sets the default sort column and order to be used by the next load operation.<div class="mdetail-params" style="margin: 10px 0px 0px; padding: 0px 0px 0px 12px; font-size: 12px;"><strong style="font-style: normal; font-weight: bold; display: block; margin-bottom: 3px; font-size: 11px; color: rgb(85, 85, 85);">Parameters:[/b]<ul style="margin: 12px; padding: 0px; list-style-type: circle; list-style-position: inside;"><li style="margin: 0px; padding: 0px; list-style-position: inside; list-style-type: circle;"><code style="font-style: normal; font-weight: normal; font-family: 'Lucida Console','Courier New',Courier,monospace; font-size: 12px;">fieldName</code> : String<div class="sub-desc" style="margin: 5px 5px 5px 16px; padding: 0px;">The name of the field to sort by.
<li style="margin: 0px; padding: 0px; list-style-position: inside; list-style-type: circle;"><code style="font-style: normal; font-weight: normal; font-family: 'Lucida Console','Courier New',Courier,monospace; font-size: 12px;">dir</code> : String<div class="sub-desc" style="margin: 5px 5px 5px 16px; padding: 0px;">(optional) The sort order, 'ASC' or 'DESC' (case-sensitive, defaults to <tt>'ASC'</tt>)[/list]<strong style="font-style: normal; font-weight: bold; display: block; margin-bottom: 3px; font-size: 11px; color: rgb(85, 85, 85);">Returns:[/b]<ul style="margin: 12px; padding: 0px; list-style-type: circle; list-style-position: inside;"><li style="margin: 0px; padding: 0px; list-style-position: inside; list-style-type: circle;">void[/list]