Store Reload does not clear selections of related grid

  1. #1

    Store Reload does not clear selections of related grid

    Grid1 has Store1 and row selection model

    load the grid, check a box

    now call this

                App.Store1.load({
                    scope: this,
                    callback: function(records, operation, success) {
                    }
                });
    i would assume calling load would clear selections but it does not.
    i need to call this manually.
                App.Grid1.getSelectionModel().clearSelections()

    Thanks
    /Z
  2. #2
    Hello @Z!

    Your thought makes sense. New data, new selection. No guarantee what's selected will still be selectable across loads.

    Yet, in the grid panel logic, or rather, selection model logic, the selected records are stored separately so when a reload/refresh happens the selection may be maintained or restored (for instance, when you want to preserve selection across sessions or over pages in paging grids). Thus, even if you're not saving a session, cookies, but still are on the same session/tab when data is refreshed, as long as the saved selection matches reloaded records they'd get selected again while rebuilding the grid.

    Thus, if you really want to reset selection, the way you're doing is almost the best route. The method you pointed is private in Ext JS framework, so you are encouraged not to use it, in favor of its public counterpart, deselectAll().

    This behavior may also depend on what specific selection model you are using in your grid panel. Depending on it it may deselect all on store reload without the need of an external stimulus. This is just a possibility, I didn't check every selection model to ensure which ones do or do not keep selection across reloads.

    Hope this helps!
    Fabrício Murta
    Developer & Support Expert

Similar Threads

  1. [CLOSED] clear grid selections in JS
    By Z in forum 1.x Legacy Premium Help
    Replies: 1
    Last Post: Jul 10, 2014, 9:55 AM
  2. Replies: 4
    Last Post: Jun 24, 2014, 2:51 AM
  3. clear checked rows after reload the grid panel
    By hongxue in forum 2.x Help
    Replies: 0
    Last Post: Jun 20, 2013, 2:38 AM
  4. Clear selections in checkbox selection model
    By Birgit in forum 2.x Help
    Replies: 0
    Last Post: May 29, 2012, 1:28 PM
  5. Clear selections of gridpanel
    By onurbozkurt in forum 1.x Help
    Replies: 4
    Last Post: Aug 19, 2009, 6:00 PM

Posting Permissions