Lets look how to load simple XML data into the grid.
Here is the XML (click to open):
<companies>
<company>
<ticker>MSFT</ticker>
<name>Microsoft Corporation</name>
<mktcap>314,571.156</mktcap>
<sales>32,187.000</sales>
<employees>55000</employees>
</company>
<company>
<ticker>ORCL</ticker>
<name>Oracle Corporation</name>
<mktcap>62,615.266</mktcap>
<sales>9,519.000</sales>
<employees>40650</employees>
</company>
...
To load and transform XML data you need an XML table model.
var table = new AW.XML.Table;
Assign a URL of the XML file.
table.setURL("/examples/data/companies-simple.xml");
By default the model looks at the documentElement as the data root. Then all child elements of the root are treated as rows and the child elements of each row node become the table cells. Exactly as this simple example looks like.
Just load the file.
table.request();
After the grid object is created
var obj = new AW.UI.Grid;
obj.setColumnCount(5);
it is assigned our new external data model.
obj.setCellModel(table);
And finally write the grid HTML to the page.
document.write(obj);