Search code examples
extjsextjs4extjs4.2

Updating Rowediting editor after a user Input


We have a rowediting plugin on grid where a button of one trigger field changes some other values of the record (we are loading some remote data which get applied to the record). The values that get changed in background are most commonly not editable, so they are just rendered. Basically the remote loading of the data works fine, meaning the record get changed and all data get save but we have the following problems:

1.The rowediting plugin does not show the changes that where applied to the record fields

2.Setting the changes via record.set() cause the store to sync immediately and not on clicking the "save" button of the editor.

So how can we make the editor to show the changes applied in the background and how can we apply these changes in a way so that they get saved along with the other edited fields.

Thanks in advance for any help!


Solution

  • This should not be that complicated, you just need a reference to your active editor instance. You can then either

    • reload the record into the form by calling loadRecord() again. But note that this may overwrite any changes that where made by now within the editor

    or (for the second way I expecting the values to be exactly the same as in the record in manner of key:value definition - short: no special mapping is required)

    • apply the new data to the record by calling either set (note that this will trigger sync if you have autoSync turned on) or by using Ext.apply(recinstance.data,newvalues) and editorinstance.getForm().setValues(newValues)