PDA

View Full Version : 'Managed is not defined' Error - while inserting new record to store



dev_java
10 Sep 2010, 12:53 AM
Hi,

I have a Store which contains some records. This store is being used by a grid. On clicking the Load button, a new window is opened and the grid is rendered in that new window.
Before rendering the window, i have to add one more record to the start (first position) of the Store.
I tried using store.insert() api. but it failed to insert and it gave an Error message in Error Console

Error: managed is not defined
Source File: http://localhost:8080/EMSpro/extjs/ext-all.js
Line: 7




dataStore = new Ext.data.Store({
id: 'dataStore ',
proxy: new Ext.data.HttpProxy(
new Ext.data.Connection({
url:'../emspro/getData.htm'
})
),
reader:new Ext.data.JsonReader({
fields: [
'data','type'
]
})
});


data_Grid = Ext.extend( Ext.grid.GridPanel, {
border: true
,id: 'data_Grid'
,initComponent:function() {
var config = {
store: dataStore,
columns: [
{header: "type", width:350, dataIndex: 'type'}
],

};
Ext.apply(this, Ext.apply(this.initialConfig, config));
data_Grid .superclass.initComponent.apply(this, arguments);
}
,onRender:function() {
data_Grid .superclass.onRender.apply(this, arguments);
}
});

Ext.reg('data_Grid ', data_Grid );


Code for beforeshow listener of Window:



listeners:{
'beforeshow':function(){
var data_Value = dataStore.recordType;
var b = new data_Value({
clli:'A' ,
type:'A' ,
});

dataStore.insert(0, b); //when i add this line to code error is shown


}
}


I have posted this unknowingly in Ext 2.x Help forum. Sorry for that.
Thank You.

Condor
10 Sep 2010, 1:05 AM
1. Errors from ext-all.js are useless. Use ext-all-debug.js for debugging.
2. Shouldn't that be:

var b = new data_Value({data:'A', type:'A'});

shivashankar
10 Sep 2010, 1:13 AM
I guess the problem occurs because of store fields does not match with new record fields

i.e store has fields [ 'data' , 'type'] but the new record you are trying to create in the listener has ['clli', 'type']

Make sure you are using the fields you specified in the grid store while adding new record to store.

dev_java
12 Sep 2010, 12:59 AM
Thanks