isc.DataSource.create({
ID:"storeDS",
dataURL:"getstores.xml",
recordXPath:"/stores/store",
fields:[
{name:"name", type:"text", title:"Name"},
{name:"storeID", type:"integer", required:true, primaryKey:true, title:"storeID" },
{name:"belongsTo", type:"text", rootValue:"root", required:true, title:"belongsTo" }
]
})
isc.TreeGrid.create({
ID:"StoreTree",
dataSource:"storeDS",
autoFetchData:true
})
XML
<stores>
<store>
<storeID>1</storeID>
<name>Temple</name>
<belongsTo>root</belongsTo>
</store>
<store>
<storeID>2</storeID>
<name>Belton</name>
<belongsTo>root</belongsTo>
</store>
</stores>
What I am getting is a parent node of Temple with a child node Belton and Belton has a child node of Temple, ect.
What I want is two nodes that are children of the implicit root node.
You have no foreignKey declared.
Note also that if you are loading the complete tree in one HTTP turnaround, you should set loadDataOnDemand to false.
Thanks for the info. Put in a top level root node and added the foreignkey att. and that did the trick. Got another question for ya.
My idea was to create the XML file to populate the treegrid then port it over to a RESTDataSource to get the info from php generated XML. I’ve been able to accomplish this. One thing I’ve noticed is that when you click on a node(loadondemand set to true) the field that has the foriegnKey is part of the URL, is there a way to change this behavior or add more parameters to the URL without using the fetchData() method?
Yes, transformRequest is designed for this. Note that if you need something else from the node whose children are being loaded, you can get to it as dsRequest.parentNode, as mentioned under Tree DataBinding.
Thanks again for the quick info. I am using the the docs trying to find this stuff out before I ask but with only a day’s experience with smartclient the hard part is knowing where to look. Makes perfect sense once you point it out!! Thanks again.