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