|
#1
|
|||
|
|||
|
I investigate SmartClient for a Web Application, integrated in a SOA architecture.
Buisness tier is already coded and services can be accessed using either XML Web services or JSON. I need to interact with very large trees so I would like nodes to be loaded on demand. The problem I face is that items in these hierarchical structures can have multiple parents so I cannot use directly the "parent TreeModelType" as specified in the documentation for my SmartClient tree (because nodes do not have unique id). I have tried to use the "children TreeModelType", ans played with "isFolder" node property but I failed to make nodes expandable. What is the (better) way to use SmartClient TreeGrid and DataSource for this kind of hierarchical structure? Should/Can I use a dedicated datasource for Parent/Children link (something like a join table)? How? |
|
#2
|
|||
|
|||
|
Hello Yann,
You do want to use the "parent" modelType. If objects have potentially colliding ids, you can tell SmartClient that some other field is the id, which you dynamically generate from dataSource.transformResponse(). For example, a common strategy is just to concatenate the object's type and it's id as a new field. You will receive this combined id when that tree node attempts to load it's children, so you will know both the id and type of the node that is loading children. If you need yet more context to figure out what service to call and what data to return, note that in both DataSource.transformRequest() and DataSource.transformResponse, you have access to the node that is loading its children (via dsRequest.parentNode) as well as the entire Tree model (dsRequest.resultTree). |