Success! Looks like we've fixed this one. According to our records the fix was applied for a bug in our system in a recent build.
  1. #1
    Ext JS Premium Member
    Join Date
    Jan 2010
    Posts
    34
    Vote Rating
    0
    gordonk66 is on a distinguished road

      0  

    Default ExtJS 4.1.0 suppressEvent is not respected in CheckboxModel.onSelectChange

    ExtJS 4.1.0 suppressEvent is not respected in CheckboxModel.onSelectChange


    Edit: Fixed in 4.0.2

    The onSelectChange function in the checkbox model class needs to be updated to include the third parameter suppressEvent.

    I found this when listening to the beforeload event of a grid store that has a checkbox selection model.

    Code:
    store.on('beforeload', function(store, operation, options) {
    // Clear all the grid selections and suppress the deselect event.
    this.getSelectionModel().deselectAll(true);
    })
    I overrode the checkbox model adding the missing param where need and now things work as expected.

    Code:
    Ext.require( [
    	'Ext.selection.CheckboxModel'
    ]);
    
    Ext.selection.CheckboxModel.override( {
    	/**
         * Synchronize header checker value as selection changes.
         * @private
         */
        onSelectChange: function(record, isSelected, suppressEvent) {
            this.callParent([record, isSelected, suppressEvent]);
            // check to see if all records are selected
            var hdSelectStatus = this.selected.getCount() === this.store.getCount();
            this.toggleUiHeader(hdSelectStatus);
        }
    })
    Last edited by gordonk66; 10 Jun 2011 at 9:40 AM. Reason: Issue has been fixed

  2. #2
    Sencha User
    Join Date
    Mar 2007
    Posts
    7,854
    Vote Rating
    4
    tryanDLS is on a distinguished road

      0  

    Default


    Please retest with 4.0.2 released today - not sure if this was something in the list of 200+ bug fixes.

  3. #3
    Ext JS Premium Member
    Join Date
    Jan 2010
    Posts
    34
    Vote Rating
    0
    gordonk66 is on a distinguished road

      0  

    Default


    I just took a look at the source and the fix is included.
    Thanks.

  4. #4
    Ext JS Premium Member
    Join Date
    Dec 2007
    Posts
    38
    Vote Rating
    0
    PHaroZ is on a distinguished road

      0  

    Default


    In ext 4.0.6 issue is not totaly fixed.

    IMHO the pb come frome the variable name and it's description
    In "select" method :
    suppressEvent : Boolean (optional)
    Set to false to not fire a select event
    In "selectAll" method :
    suppressEvent : Boolean
    True to suppress any select events
    Wich is the excat opposite although both methods call
    this.doSelect(..., ..., suppressEvent);

  5. #5
    Ext JS Premium Member
    Join Date
    Dec 2007
    Posts
    38
    Vote Rating
    0
    PHaroZ is on a distinguished road

      0  

    Default


    Checked against Ext 4.1 and issue seems to be always be present ...

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

      0  

    Default


    You guys only fixed it for select method. suppressEvent is ignored with selectAll.

    I just tested it in 4.1.1.

    Use this override until it's fixed by the Sencha devs. It's a copy paste of the original selectAll with the fix in red.

    Code:
    Ext.override(Ext.selection.Model, {
       selectAll: function(suppressEvent) {
            var me = this,
                selections = me.store.getRange(),
                i = 0,
                len = selections.length,
                start = me.getSelection().length;
    
    
            me.bulkChange = true;
            for (; i < len; i++) {
                me.doSelect(selections[i], true, suppressEvent);
            }
            delete me.bulkChange;
            // fire selection change only if the number of selections differs
            me.maybeFireSelectionChange(me.getSelection().length !== start && !suppressEvent);
        }
    });

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

      0  

    Default


    I think I understand what's happening. ExtJS devs probably intended to only suppress select en deselect events with suppressEvent=true. I _thought_ it would also suppress selectionchange event, but that just probably was never the intention of the ExtJS devs.

    So, this might by not a bug, but ambiguous at least. However, if you wish to _also_ suppress the selectionchange event, use the override as described above.

    (Note that deselectAll also needs the same in && !suppressEvent in the last line if you wish to suppress the selectionchange there)

  8. #8
    Sencha User Daniil's Avatar
    Join Date
    Jun 2010
    Location
    Saint-Petersburg, Russia
    Posts
    975
    Vote Rating
    112
    Daniil is a name known to all Daniil is a name known to all Daniil is a name known to all Daniil is a name known to all Daniil is a name known to all Daniil is a name known to all

      0  

    Default


    Hi,

    I reported the issue with selectionchange suppressing.
    http://www.sencha.com/forum/showthread.php?250836

    I also expect it should be suppressed.
    Ext.NET - ASP.NET for Ext JS
    MVC and WebForms
    Examples | Twitter