PDA

View Full Version : record item as xml from renderer



alupuli
23 Feb 2010, 3:43 PM
xml is like

xmlstring = '<Root>
<Item title="First" a="12" b="123" c="3444" d="6565/>
<Item title="Second" a="12" b="123" c="3444" d="6565/>
<Item title="Third" a="12" b="123" c="3444" d="6565/>
</Root>'
var myXmlReader = new Ext.data.XmlReader({
record: 'Item',
id: '@a'
},
[{
name: 'title',
mapping: '@title'
}]);
var ds = new Ext.data.Store({
reader: myXmlReader,
data: getXmlDoc(xmlstring)
});
var cm = new Ext.grid.ColumnModel([{
header: "<b><u>Results</u></b>",
sortable: false,
locked: false,
dataIndex: 'title',
renderer: renderPlus
}]);


function renderPlus(value, p, record) {
//can I get Item as an xml from record.
// like '<Item title="First" a="12" b="123" c="3444" d="6565/>'
//instead of reading attributes one by one like
//record.data.a
}

bclinton
23 Feb 2010, 4:42 PM
I don't think Ext has any native way for a Store to output data as XML. You'll need to write your own function for that.

I don't think that the data being in XML format originally helps at all. Once it is read into the Store via the XMLReader it is no longer XML.