Go Back   SmartClient Forums > Technical Q&A
Wiki Register Search Today's Posts Mark Forums Read

Reply
 
Thread Tools Search this Thread
  #1  
Old 8th Dec 2008, 13:44
yann.boncompagni yann.boncompagni is offline
Registered Developer
 
Join Date: Dec 2008
Posts: 2
Default TreeGrid and Load on demand

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?
Reply With Quote
  #2  
Old 8th Dec 2008, 13:56
Isomorphic Isomorphic is online now
Administrator
 
Join Date: May 2006
Posts: 30,553
Default

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).
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search


© 2010,2011 Isomorphic Software. All Rights Reserved