PDA

View Full Version : Programtically writing values to grid



darkling235
23 Jan 2010, 1:01 PM
I have a popup on my editor grid that lets users set several cells with data. When they enter the data, I grab the Store and add the values but the store.commit doesn't work. It seems that the store even though it has the correct values inside it according to the debugger, never flipped its modified bit because the modified value inside is an empty array. What should I do so that the store will publish the values I wrote?

darkling235
25 Jan 2010, 6:42 AM
I found a ChangeEvent class that might be related to this but I'm not completely clear on how it works. Do I need to add a ChangeListener and override methods so that when I use
data.set("name", value)

the store will understand that the value has changed without going through the grid and I want it to be persisted?

moegal
25 Jan 2010, 8:10 AM
Have you tried to refresh view?

grid.getView().refresh();

Thanks, Marty

darkling235
25 Jan 2010, 8:40 AM
No I figured out the problem. I was writing to the model but not to the record so technically it was correct there had been no change.

I was doing
BaseModel MyModel = MyListStore.getAt(0);
MyModel.set("name", value);

What finally worked was:
BaseModel MyModel = MyListStore.getAt(0);
Record r = MyListStore.getRecord(MyModel);
record.set("name", value);

This way the record is updated and the commit happens normally.