Suppress select and deselect events when selection memory is working

  1. #1

    Suppress select and deselect events when selection memory is working

    Hello,

    Is there any way how I can suppress select and deselect events when selected items are restoring from selection memory plugin? For example, I have the following code:

    <ext:CheckboxSelectionModel ID="CheckboxSelectionModel" runat="server" CheckOnly="true">
      <Listeners>
         <SelectionChange Fn="App.TenderWindow.onCarrierGridSelectionChange" />
         <BeforeDeselect Fn="App.TenderWindow.onBeforeCarrierDeselect" />
         <Select Fn="App.TenderWindow.onCarrierSelect" />
         <Deselect Fn="App.TenderWindow.onCarrierDeselect" />
       </Listeners>
    </ext:CheckboxSelectionModel>
    I do not need so select and deselect events would be fires every time when selected records are restoring during the first page load or when I go from one page to another.

    Thanks,
    Alexander
  2. #2
    Try this
    Ext.grid.plugin.SelectionMemory.override({
                memoryRestoreState : function () {
                    this.selModel.suspendEvents();
                    this.callParent();
                    this.selModel.resumeEvents();
                }
            });
  3. #3
    Hello Vladimir,
    Thanks for your answer. I tired but it doesn't work well. memoryRestoreState is calling every time during the first load and when you change the page, but I found then when it called for the first page, list of initially selected Ids is empty. For example, here is a code from memoryRestoreState

                    if (sel.length > 0) {                
                        this.selModel.select(sel, false, false);
                    }
    During the first load sel array is empty, so select method is not called. However, by some miracle selected records are restored somehow. When you are changing a page all is working fine sel array contains selected Ids, select is calling and you code works well.

    What do you think?

    Regards,
    Alexander
    Last edited by Svr77; Sep 27, 2012 at 5:44 AM.
  4. #4
    Ok, I found the reason why it doesn't work for the first time. The problem was in SelectionSubmit. During render it is calling method initSelectionData, then calling doSelection and after that selModel.select(records). As results events are still firing. So I added this code and now all is working fine.

          Ext.grid.plugin.SelectionSubmit.override({
            doSelection: function () {
              this.selModel.suspendEvents(false);
              this.callParent();
              this.selModel.resumeEvents();
            }
          });
    However I still have two questions :-)

    1) When SubmitSelection is firing when I used SelectionSubmit="false" for GridPanel?
    2) May be it would be better to call selModel.select(records, false, false) in SubmitSelection so events won't fire during the first load?


    Regards,
    Alexander

Similar Threads

  1. [CLOSED] selection memory across pages with httpproxy not working...
    By rthiney in forum 1.x Legacy Premium Help
    Replies: 1
    Last Post: Oct 05, 2011, 1:47 PM
  2. Replies: 0
    Last Post: Sep 13, 2011, 6:59 AM
  3. Replies: 3
    Last Post: Jun 10, 2010, 11:59 AM
  4. Multi Select select/deselect
    By Palash in forum 1.x Help
    Replies: 2
    Last Post: Sep 18, 2009, 3:49 AM
  5. Can't deselect GridRow with multiple selection
    By dbassett74 in forum 1.x Help
    Replies: 1
    Last Post: Jun 07, 2009, 3:07 PM

Tags for this Thread

Posting Permissions