This issue duplicates another issue.
  1. #1
    Sencha Premium Member
    Join Date
    May 2012
    Posts
    66
    Vote Rating
    1
    stevanicus is on a distinguished road

      0  

    Default ComboBox suspendEvents doesn't work

    Ext version tested:
    • Ext 4.1.1-rc2
    Browser versions tested against:
    • FF14
    Description:
    • I am trying to suspend the events of a combobox, set a value in that combobox and resumeevents afterwards
    Steps to reproduce the problem:
    • Create a combobox
    • Add an xtype selector listener in a controller
    • 'mycombobox':{change:mychangefunction}
    The result that was expected:
    • that it wouldnt fire mychangefunction()
    The result that occurs instead:
    • it still fires mychangefunction()
    Code:

    I have an array of comboboxes that I obtained by using .query() on a panel. Then I iterate the through them and set a value in each.

    Code:
    console.info("silent", silent, typeof silent == "boolean")
            
            if(optionsStore && views && viewSelectors){
                
                for(var i = 0, l = viewSelectors.length; i < l; i++){
                    
                    var viewRecord = optionsStore.findRecord("portal", views[i]);
                    
                    if(silent){
                        viewSelectors[i].suspendEvents();
                    }
                    
                    console.info("viewSelectors[i]", viewSelectors[i], viewSelectors[i].eventsSuspended);
                    viewSelectors[i].setValue(viewRecord);    
                    console.info("viewSelectors[i]", viewSelectors[i], viewSelectors[i].eventsSuspended);
                    
                    if(silent){
                        viewSelectors[i].resumeEvents();
                    }
                }
                
            }    
            
            console.info("silent", silent, typeof silent == "boolean")
    The console with viewSelectors[i].eventsSuspended = 1
    Set the change events of viewSelectors[i].setValue(viewRecord);
    are still fired.

    Thanks in advance

  2. #2
    Touch Premium Member
    Join Date
    Nov 2010
    Location
    Chicago
    Posts
    1,631
    Vote Rating
    477
    LesJ has a brilliant future LesJ has a brilliant future LesJ has a brilliant future LesJ has a brilliant future LesJ has a brilliant future LesJ has a brilliant future LesJ has a brilliant future LesJ has a brilliant future LesJ has a brilliant future LesJ has a brilliant future LesJ has a brilliant future

      1  

    Default

    I believe this might be a duplicate bug report, see this

  3. #3
    Sencha Premium Member
    Join Date
    May 2012
    Posts
    66
    Vote Rating
    1
    stevanicus is on a distinguished road

      0  

    Default

    looks like your right - thanks

  4. #4
    Ext JS Premium Member devtig's Avatar
    Join Date
    Jan 2010
    Location
    Rotterdam, The Netherlands
    Posts
    400
    Vote Rating
    14
    devtig will become famous soon enough

      0  

    Default

    I found a solution for comboboxes. It doesn't fix it in the core, but at least you get your trigger to not fire.

    Code:
    mycombobox.suspendCheckChange++;
    mycombobox.setValue(value);
    mycombobox.suspendCheckChange--;

Thread Participants: 2

Tags for this Thread