Note that there are some explanatory texts on larger screens.

plurals
  1. POExtJs: determine grid that fires the update event on a store
    primarykey
    data
    text
    <p>i use a livegrid in ExtJs 3.3.1 but believe this question is global to ExtJs. How does a listener on a store know which grid the event comes from ?</p> <p>Here why and some code.</p> <p>I have a listener on a store and on update i would like to know which rows were selected in the grid and also suspend the events. This all so that i can make a selection in the grid, update a field in that range and update that field in the whole selection. Selection is done without a checkbox, just by highlighting the rows. Since this listener is used by many grids i need a way to get it froml what the gridlistener gets as parameters but that is only store, record and action</p> <pre><code>Ext.override(Ext.ux.grid.livegrid.Store, { listeners: { 'update': function(store, record, action) { if (action=='commit'){ //each update has 2 actions, an edit and a commit var selected = grid.getSelectionModel().getSelections(); //need to know which grid if (selected.length&gt;1){ //if more than one row selected grid.suspendEvents(); store.writer.autoSave = false; for(var i=0; i &lt; selected.length; i++){ if (this.fieldChanged) { for (var name in this.fieldChanged) { //get the field changed and update the selection with the value if (selected[i].get(name)!=this.fieldChanged[name]){ selected[i].set(name, this.fieldChanged[name]); } } } } grid.resumeEvents(); store.fireEvent("datachanged", store); store.writer.autoSave = true; } } if (action=='edit'){ this.fieldChanged = record.getChanges() } } } }); </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload