Start Building Professional
Web Apps Today


 
Categories Question details Back To List
Question  posted on Nov 05, 2008 16:23
open dhtmlx forum
custom XML on serialize()

I am using myGrid.serialize()

Instead of this XML format:
<?xml version="1.0"?><rows><row id='1'><cell>5550042</cell><cell>55.99</cell><cell>Y</cell></row></rows>

I need to create custom XML, such as:
<?xml version="1.0"?><rows><row id='1'><cell id="itemNumber">5550042</cell><cell id="itemPrice>55.99</cell><cell id="onStock">Y</cell></row></rows>

How may I insert these cell ids?

Thanks
Answer posted by Support on Nov 06, 2008 01:58
The next appoach can be used

mygrid.xml.cell_attrs=["id"];
mygrid.cells(1,0).setAttribute("id","itemNumber"); //you need not this code if original XML already contains id attribute
mygrid.cells(1,1).setAttribute("id","itemPrice");
mygrid.cells(1,2).setAttribute("id","onStock");


var data = mygrid.serialize();
Answer posted on Nov 06, 2008 06:16
for some reason, IDs are not incerted... anything else I should add? Thanks
Answer posted on Nov 06, 2008 07:15
OK, got it:  you have to use myGrid.xml.cell_attrs.push("id"); at the end. It works now. Thanks!