I am looking into tree binding examples. All xml data is shown as an element based. Can I bind a tree widget to an attribute based xml?
Thanks
I am looking into tree binding examples. All xml data is shown as an element based. Can I bind a tree widget to an attribute based xml?
Thanks
Yes - you can use attributes or sub-elements for atomic values in your XML.
attributes in XML to be in a Tree
I am having the same question.
Basically, I have a structure in XML whereby:
<Route name="MainRoute" ID="123">
<InnerRoute symbol="stopSign" symbolID="abc"/>
<InnerRoute symbol="yieldSign" symbolID="def"/>
<Swale width="5" swaleID="zzz"/>
</Route>
and I wish to represent this as a Tree, thus:
MainRoute
– stopSign
– yieldSign
– 5
The DataSource that I am wishing to create is:
isc.DataSource.create({
ID:"bigroute",
dataURL:"/routes/routeShow.do?type=all",
recordXPath:"//Route",
autoFetchData:false,
fields: [
{type:"text",
required:true,
name:"routeName",
valueXPath:"@name"
},
{type:"text",
required:true,
name:"symbolName",
valueXPath:"/InnerRoute/@symbol"
},
{type:"text",
required:true,
name:"swaleWidth",
valueXPath:"/InnerRoute/Swale/@width"
}
]
});
…and the Tree Grid as:
isc.TreeGrid.create({
ID:"Routes",
dataSource:"bigroute",
loadDataOnDemand:true,
autoFetchData:true,
autoDraw:true,
height:"100%"
})
What do get, however, is just a list of never-ending repeats of nested values of only the route “@name” attribute.
Thank you in advance!
Hi sonny,
Your XML sample doesn’t really correspond to a single DataSource - it’s actually a series of different types of elements with unrelated sets of properties.
A couple of options:
change the XML output so that you have a common set of tagNames and attributes across all record types, following the pattern shown for trees loading XML.
if you load this file with loadXML, you could use a DOMGrid to view it.
Interesting. DOMGrid sounds like what I may just need. Thank you; I will try that out!