PDA

View Full Version : Updating an array in a store and getting grid to redraw?



ajmas
11 Jan 2011, 1:57 PM
I am wanting to update a the value in a record and in doing so have the grid display the new value.

What I am finding is that if I make a change to the value such that the reference stays the same, say when adding a value to an array, then the record is not detected as being modified. On the other hand if I change the value such that the reference changes, then the record is detected as being modified, say when I am specify a new array. This means I have code as follows:



var record = this.myStore.getAt(recordIdx);
var roleList = record.get('roles');

roleList.push ( 'therole' );

record.set('roles',[]);
record.set('roles',roleList)



Without the first set() the record seems to be treated as if it is unmodified. Is there a proper way to telling the record that its member value has modified content?

13 Jan 2011, 5:51 AM
record.beginEdit();
// your changes go here
record.endEdit();
record.commit();