PDA

View Full Version : Loading data to Ext.FormPanel from store.



maxkliver
15 Nov 2012, 10:26 PM
I have a store and FormPanel. And i want to show data from store in panel.
If i do this:


var store_form=null;
store_form = new Ext.data.Store({
url: url_servlet+"kadastr_zemform.jsp",
reader: new Ext.data.XmlReader({
totalProperty: "results",
record: "contact",
fields: [ ]}),
listeners: {
'load' : function(store_form,records,options) {
this.loaded = true;
var record = store_form.getAt(0); podform.getForm().loadRecord(record);
}
}
});
});
store_form.load();

All froms fine.
But if i call loadRecord() in formPanel's listener i get error:



TypeError: store_form.getAt is not a function
(624 out of range 31)

My code.



var podform = new Ext.FormPanel({
labelAlign: 'left',
id: 'tab_6',
frame:true,
title: '???????? ???????',
bodyStyle:'padding:5px 5px 0',
width: 600,
listeners: {
'activate' : function(store_form,records,options) {
console.log("store:"+store_form);
this.loaded = true;
//alert("loaded");
//console.log(store.getAt(0));
var record = store_form.getAt(0);
podform.getForm().loadRecord(record);
}
},
fields[]
});


Whats wrong with it?

johnfanyong
15 Nov 2012, 11:25 PM
FromPanel activate : ( Ext.Panel p )
the first param of activate listener is Ext.Panel.It's not store

maxkliver
16 Nov 2012, 12:58 AM
Thank you its works.