Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
Clear All
new posts

    TreeGrid load on demand and parentNode

    Hi Isomorphic,

    I am hoping this is a simple question. We have usually loaded Trees in SmartClient using initialData first with it being set in the response from a struts action. When any node is expanded, we load on demand and send the request to our custom Java back-end datasource using transformRequest. In this case, I have some criteria and the criteria for the ancestorNode (the node clicked in the tree) automatically is changed, so by the time it reaches the server, we have the correct node ID.

    Code:
    dataSource: isc.addProperties(MyTreeDS, {
    	transformRequest: function(dsRequest) {
    		var params = {
    			someProperty: <propVal>
    		};
    		return isc.addProperties({}, dsRequest.data, params);
    	}
    })
    All we have changed now is to call fetchData() (below) when the page loads instead of loading the data using the initialData property. But now, every time I try to expand a collapsed node, the ancestorNodeId in the dsRequest.data in transformRequest is always the rootId value.

    I don't understand why this is the case. I looked at the Smart Client documentation and debugged the parentNode property in dsRequest when inside transformRequest, but it is always null. Is there a way to enable showing this so I can reset ancestorNodeId to the correct node in transformRequest?

    Code:
    hierarchyTree.fetchData(
    	null,
    	hierarchyTreeCallback,
    	{ data: {
    		includeRootNode: true,
    		ancestorNodeId: <rootId>
    } });

    #2
    This really isn't enough information for us to narrow down the cause.

    Generally, if you open a node, it's node.id, as configured by tree.idProperty or by automatic choosing from the DataSource, is what is sent to the server.

    For loading root-level nodes, assuming you are using the default behavior of having an implicit root node that is not visible to the user, then the tree.rootValue is used in the criteria, which comes from the foreignKey field in the DataSource - see DataSourceField.rootValue.

    Comment

    Working...
    X