View Full Version : Updating Row Items in Ext.grid.GridPanel ?

7 Jul 2009, 4:51 PM
I am newbie to ExtJS, and I am having trouble editing Record Row Items in my Ext.grid.GridPanel. I saw some examples using the EditGridPanel, but I can't use that control since I inherited existing code. Can someone help me figure this out please?

//My first attempt to edit the GridPanel

createWindow.on('beforeclose', function(p){

var rec = d.data.msgGrid.getStore().getAt(6); // Get the Record
rec.set('description','test'); //should work right?

That seemed like it would work, but then I ran into a problem when attempting to access another column in the store. It was in an xml format, but I believe that may be due to the fact that it was a GeoExt.data.FeatureStore. Would that present a problem or change my approach?

Thanks so much:)

8 Jul 2009, 5:02 AM
This looks like you are going in the right direction.

When updating any data in a grid you always interact with the Ext.data.Store, not the grid itself. As you change data in the store the grid's UI will immediately update itself because you have changed that data in the store.

The Store allows you to pull data in any format with a reader. JsonReader and XmlReader are the most common readers you will see. Once your raw data has been read into the store you interact with it in the same way regardless of whether it came in JSON, XML or some other format. (In other words, it shouldn't matter!)

Taking a look at the code above. What is d? Are you guaranteed that there is a record at index 6?

8 Jul 2009, 8:25 AM
I was able to get it to work, but I get an error after the sets are made, and the update event is thrown.

One of the methods are throwing the following error: "0.firstChild' is null or not an object" I'm having some troubling figuring out which methods are subscribing to this event though. I started a new thread since this new question is a bit more specific.

Thanks again.