Hi,
1) I was unable to read from the documentation how to read a XML string with the XMLReader. The XML string I stored in a JS Variable. The grid doesn't load the data - however, firebug doesn't capture any JS errors neither. The grid seems okay, I can easily add records. No problem with that.
2) Since I managed to add records to the grid, how can I export the data using the xmlData Property from the XMLReader? (I need to add the xml to an input field, so I can submit the data to the target page - along with other input fields)
Anybody experienced local XMLReader loading ANDxmlData extraction with EXTJS 1.1?
Thanks heaps
Code:
var xmlData = "<?xml?><vehicles><vehicle><ID>1001</ID><brand>Citroen</brand><model>Saxo</model><type>XXX Edition</type></vehicle></vehicles>";
var ds = new Ext.data.Store({
proxy: new Ext.data.MemoryProxy(xmlData),
// the return will be XML, so lets set up a reader
reader: new Ext.data.XmlReader({
// records will have an "T4" tag
record: 'vehicle',
id: 'ID',
totalRecords: "recCount"
}, [
'brand', 'model', 'type'
])
});
var cm = new Ext.grid.ColumnModel([{
id: 'ID',
header: "Marke",
dataIndex: 'brand',
width: 120
},{
header: "Modell",
dataIndex: 'model',
width: 120
},{
header: "Type",
dataIndex: 'type',
width: 40
}
]);
// by default columns are sortable
cm.defaultSortable = true;
grid = new Ext.grid.Grid('divGrid', {
ds: ds,
cm: cm
});
grid.render();
ds.load();