Login Register

dijit.Tree and dynamic data from DWR

Hi,

I'm currently porting a project from dojo 0.3 to 1.1.1. We use some trees that are dynamicaly loaded with data from the server, bij DWR services. In 0.3 it was easy to connect to the expand events, load data with DWR and create and add treenodes to the tree. This is essentially what we did in 0.3 (not real code, just to explain my case):

onOpened: function(openedNode) {
  var callback = function(subItems) {
      dojo.lang.forEach(subItems, function(subItem) {
         var newChild = dojo.createWidget("TreeNode", {//create subNode here//});
         openedNode.addChild(newChild);   
  };
  DWRService.getSubItems(openedNode.id, callback);
}

I'm now trying to port that to the dataStore mechanism from dojo 1.

I found several topics on how to load data dynamicaly, using the ItemFileDataStore or QueryDataStore. These stores however assume there is an url where some json data can be fetched. Because we are using DWR (2.0), this is not the case in our situation. We want to keep loading the data with DWR.

What would be the best way to integrate the DWR servercalls into a datastore? Is there maybe another store that would be more usefull for this? Maybe someone has a suggestion which methods from the ItemFileReadStore to override?