[CLOSED] Reset store's sort info on grid reload/reconfigure

  1. #1

    [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.
  2. #2

    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.
  3. #3

    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]


  4. #4
    in v0.8, I can set store.SortInfo = Nothing to reset the sort. In v1.0, that property is now readonly. If I do store.SetDefaultSort("", ASC), it will sort on rownumber column. How can I tell store to not sort on anything at all?
  5. #5
    Hello, jchau!

    To delete SortInfo from code behind you can use the following thing:
    X.AddScript("delete Store1.sortInfo;");
  6. #6
    I did "Store1.sortInfo = null;" and it seems to work. That's the script generated in v0.8 when I set sortInfo = nothing in codebehind. Will this be added back to the toolkit? A simple Store.clearSort function that just outputs the script for me.
  7. #7
    Hi,

    You can call the following code
    Store1.Set("sortInfo", null);

Similar Threads

  1. [CLOSED] How to update all updated grid info in Editable Grid?
    By rnachman in forum 1.x Legacy Premium Help
    Replies: 4
    Last Post: Dec 06, 2011, 3:56 PM
  2. [CLOSED] [1.0] GridPanel's reconfigure reset columns' filter property
    By PoloTheMonk in forum 1.x Legacy Premium Help
    Replies: 9
    Last Post: Sep 21, 2011, 10:39 AM
  3. [CLOSED] Remove sort info
    By caha76 in forum 1.x Legacy Premium Help
    Replies: 1
    Last Post: Mar 21, 2011, 8:30 AM
  4. [CLOSED] [1.0] Issue w/ Store & Grid.reconfigure
    By randy85253 in forum 1.x Legacy Premium Help
    Replies: 8
    Last Post: Nov 10, 2009, 1:36 PM
  5. How to reset the gridview's page when store reload?
    By tangcan2003 in forum 1.x Help
    Replies: 1
    Last Post: Mar 06, 2009, 12:15 PM

Posting Permissions