PDA

View Full Version : Edit grid content at runtime



a.pinti
4 Nov 2009, 6:15 AM
Hello,
i wish to edit a grid cell programmatically.

I have a form panel with a save button that invokes this code:


function(btn){
var grid = Ext.getCmp("fields_grid");
var form = btn.findParentByType("form");
Ext.getCmp("conf_window").close();
grid.getSelectionModel().selection.record.data.config = Ext.encode(form.getForm().getValues());
return false;
};


I'm trying to edit cell from grid.getSelectionModel().selection.record.data but it doesn't works.
There's a better way to do it?
Thanks
Andrea

a.pinti
4 Nov 2009, 7:33 AM
Ok I found a solution :)

I had to use Record method set:



var grid = Ext.getCmp("fields_grid");
var form = btn.findParentByType("form");
Ext.getCmp("conf_window").close();
var values = Ext.encode(form.getForm().getValues());
grid.getSelectionModel().getSelected().set("config", values);
return false;