PDA

View Full Version : XmlStore help



mtonina
12 Feb 2014, 5:33 AM
Hi! I read the API and some help in this forum, but I still in problems with my first XmlStore implementation.

I have a static XML like this:



<List cls="class">
<Head>
<ColHead title="Uri" att1="abc" name="uri"/>
<ColHead title="Title2" att1="abc" name="title2"/>
<ColHead .../>
</Head>
<Line>
<Entry value="value1"/>
<Entry value="value2"/>
<Entry value="..."/>
</Line>
<Line>
<Entry value="...>
<Entry value="...>
<Entry value="...>
</Line>


I need to map this to a new store. I don't need the <Head> tag, and I tried with this code:



var fields = ... some code to get the fields (it's working right now)
for (var j = 0; j <= fields.length; j++) {
var cField = fields[j];
mapping[j] = {name: cField, mapping: "Entry[" + (j+1) + "]"};
}

var store = Ext.data.XmlStore({
storeId: "storeID",
data: data,
record: "Line",
fields: mapping
});


Obviously, there is something missing. It returns me the following exception:

TypeError: this.addEvents is not a function
'save'

I need some help to define the store correctly, because is my first-time, and I'm not sure about how to handle this issue with "data" attribute in the store definition.

Thanks!