PDA

View Full Version : Help required in xmlstore.Error: Ext.data.XmlStore is not a constructor



arunsenthild
2 Aug 2010, 11:27 PM
Hi,
I'm new to Extjs and js. As i see from xmlstore options, we can use url or data to feed the data to extjs. for the data can i use jsonobject or i should use xml? My code is as follows

function pop_fields_from_xml(a)
{
var myJsonObject = new Array();
myJsonObject=xml2json.parser(ginfo_xml);

var store = new Ext.data.XmlStore({
autoDestroy: true,
storeId: 'INFOLET',
data: myJsonObject,
record: 'FILTER',
idPath: 'FILTER_NAME',
fields: [
// set up the fields mapping into the xml doc
// The first needs mapping, the others are very basic
{name: 'PARAM', mapping: 'PARAM > PARAM_NAME'}

]
});

and my xml is as follows..
<INFOLET>
<FILTER>
<FILTER_NAME>FILTER_DEPT</FILTER_NAME>
<PARAM>
<PARAM_NAME>DEPTNO</PARAM_NAME>
</PARAM>
</FILTER>
<FILTER>
<FILTER_NAME>FILTER_SAL</FILTER_NAME>
<PARAM>
<PARAM_NAME>SAL_PARAM</PARAM_NAME>
</PARAM>
</FILTER>
<FILTER>
<FILTER_NAME>MAJOR_FILTER</FILTER_NAME>
<PARAM>
<PARAM_NAME>DEPTNO</PARAM_NAME>
</PARAM>
<PARAM>
<PARAM_NAME>SAL_COMPARISON2</PARAM_NAME>
</PARAM>
<PARAM>
<PARAM_NAME>EMPNAME</PARAM_NAME>
</PARAM>
<PARAM>
<PARAM_NAME>SAL_COMPARISON1</PARAM_NAME>
</PARAM>
</FILTER>
</INFOLET>

when i execute this code im getting a error saying Error: Ext.data.XmlStore is not a constructor
Please correct me if im missing something.

arunsenthild
3 Aug 2010, 6:07 AM
Someone please help me in this regard.. Appreciate your advice on this.

Condor
3 Aug 2010, 6:14 AM
X is not a constructor probably means that you forgot to include the .js file.

Secondly, an XmlStore is NOT meant to process JSON data. You should use it to process an XML document (so don't use xml2json).