Results 1 to 8 of 8

Thread: Ext.ux.MultiRowUpdateSelectionModel

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Sencha Premium User mankz's Avatar
    Join Date
    Nov 2007
    Location
    Stockholm, Sweden
    Posts
    3,042
    Vote Rating
    182
      0  

    Default Ext.ux.MultiRowUpdateSelectionModel

    A client of mine wanted multi-row update for a large grid where he often updated many rows with the same values. Select by checking rows in the selection column, then any change to an editable field will propagate to the selected records.

    Live example

    Code:
    Ext.namespace('Ext.ux');
    
    Ext.ux.MultiRowUpdateSelectionModel = Ext.extend(Ext.grid.CheckboxSelectionModel, {
        initEvents : function(){
            Ext.ux.MultiRowUpdateSelectionModel.superclass.initEvents.call(this);
            this.grid.on('afteredit', function(editEvent) {
              if (this.grid.selModel.selections.getCount() > 0)
              {
                this.grid.selModel.selections.each(
    	            function(rec) {
    	              if (rec !== editEvent.record)
    	              {
    	                rec.set(editEvent.field, editEvent.value);
    	              }
    	          });
    	        }
            }, this);
        }
    });
    If using this with Ext versions < 2.2, you might want to add the code below to stop the edit click to act as a row selection.

    Code:
        // Deactivate row selection by row click
        handleMouseDown : Ext.emptyFn
    Last edited by mankz; 25 Sep 2008 at 10:28 AM. Reason: Updated for Ext 2.2

Posting Permissions

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