How to set multiple values at one time to Ext.data.Model?

extjs, model

Solution

That's not possible, but as per my understanding you only want to merge this different calls for setting a value in model when you need to notify about changes in model only once to store so store will only fire `update` event once

If this is the case for you then you can use `beginEdit` and `endEdit` functions

var model = new Ext.data.Model();

model.beginEdit();

model.set('field1', 'value1');
model.set('field2', 345);
model.set('field3', true);

model.endEdit();

Problem

In `Ext.data.Model` class we have `set(fieldName, newValue)` method which sets one model field to the given value. How to set multiple values at one time? Something like: ``` Ext.data.Model.set({ field1: 'value1', field2: 345, field3: true }); ```

Original source