Results 1 to 9 of 9

Thread: ExtJS 4.1.0 suppressEvent is not respected in CheckboxModel.onSelectChange

Hybrid View

Previous Post Previous Post   Next Post Next Post
    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
    1
      0  

    Default 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
    3
      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
    1
      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
      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
      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
    419
    Vote Rating
    14
      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);
        }
    });

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •