PDA

View Full Version : refresh grid



Sgt.Pepper
25 Sep 2009, 6:33 AM
Hello,

I have a GridPanel with a store behind it.

Now I programatically change a record in the store.

How can I trigger the grid, to show the updated value from the store?

thenewmexican
25 Sep 2009, 7:55 AM
grid.refresh();

Condor
25 Sep 2009, 8:29 AM
No, the grid will automatically update if you change a record in the store.

How did you change the record? You should be using:

// change single value
record.set('field1', value1);

// change multiple values
record.beginEdit();
record.set('field1', value1);
record.set('field2', value2);
record.endEdit();

thenewmexican
25 Sep 2009, 9:12 AM
This is from the examples


rowEditor.stopEditing();
store.insert(0,newObj);
grid.getView().refresh();
grid.getSelectionModel().selectRow(0);
rowEditor.startEditing(0);

Condor
25 Sep 2009, 9:18 AM
Strange, the refresh() call really isn't needed (insert will fire an add event that the grid uses to update).

thenewmexican
25 Sep 2009, 9:20 AM
I hear ya.
But. This is the only way that I have used code to insert stuff into a grid.
Sometimes the examples are a little confusing. Since. It appears that there are numerous
ways to get from point A-B

Sgt.Pepper
28 Sep 2009, 12:28 AM
Thank you for your replies.

Instead of


record.beginEdit()
record.set('X','Y')

I was just doing a

record.data.X = Y

With the correct functions, everything works fine and the grid gets updated automatically...

thenewmexican
28 Sep 2009, 6:24 AM
Thanks for the reply.
But. Your response has no bearing on the abysmal Grid rendering issues. The render/resize issues are even worse on Windows IE. Its time to have a look at Flex.