PDA

View Full Version : New inserted row in a grouped grid is not visible ...



emils
10 Dec 2011, 1:35 AM
Hi,

The case is like follows:

I have grouped grid and a form on right. When a row on the grid is selected, the record is visualized on the form.
BUT when i insert a record it is not visible in a grid. I am sure that the record is inserted correct in the model and it is "selected" by sellectionmodel of the grid, becouse this record is shown in the form ( with new ID, returned from back-end )


Is this a bug or i miss something ?


here is the code:



var SelectedRec = Ext.getCmp("grid").getSelectionModel().getSelection();
var RegionSTR = SelectedRec[0].get('REGION');
Ext.Ajax.request({
url: 'main.php?type=insert',
method: 'POST',
params : { region: RegionSTR },
success: function(objServerResponse){
var obj = Ext.decode(objServerResponse.responseText);
if (obj.success == "true") {
var e = Ext.ModelManager.create({
A_ID: obj.data.A_ID,
TYPE: obj.data.TYPE,
PURPOSE: obj.data.PURPOSE,
REGION: obj.data.RegionSTR // THIS IS GROUPED FIELD
}, 'Armeec');
Ext.getCmp('grid').getView().refresh();
Ext.getCmp('grid').getSelectionModel().select(e);
} else {
***************
}

vadimv
10 Dec 2011, 2:57 AM
Actually you don't insert it in the grid, you only create an instance of the "Armeec" model, to have it in the grid use store.add or store.insert.
'Ext.ModelManager.create' is deprecated in 4.0.7 use Ext.create instead.