views:

248

answers:

0

I use dojo 1.3.2 with the Zend Framework 1.10 JSON Server. I can successfully execute my method getTreeByScope defined as SMD via JSON-RPC 2.0

myService.getTreeByScope({scopeId:1,nodeId:0});

this sends this POST request:

{"id":1,"method":"getTreeByScope","params":{"scopeId":1,"nodeId":0},"jsonrpc":"2.0"}

All is fine.


Now i wanted to use the forest dijit with the service:

this._gemStructureStore = new dojox.data.JsonRestStore({labelAttribute:"title", service:this._gemStructureServices.getTreeByScope});
this._gemStructureModel = new dijit.tree.ForestStoreModel({store: this._gemStructureStore, labelAttr: "name", deferItemLoadingUntilExpand: true, query: {scopeId:1,nodeId:0}, childrenAttrs: ["children"]});
this._gemStructureTree  = new dijit.Tree({showRoot: true, model: this._gemStructureModel, onClick: this.nodeClicked, id: "myTree", label: "root"});
document.body.appendChild(this._gemStructureTree.domNode);

But now the executed query Method from the dojox.rpc.JsonRest comes with 2 arguments (deferred = service(id, args)) and the folowing dojo._hitchArgs Method in dojo._base.lang produces now an array with my named parameters. This is the POST request:

{"id":1,"method":"getTreeByScope","params":[{"scopeId":1,"nodeId":0},{"query": "scopeId":1,"nodeId":0}],"jsonrpc":"2.0"}

And now the Zend Server can't handle the params any more.

  • I could try perhaps to hitch a customized _hitchArgs Method to the Service. But i don't know how.
  • Perhaps i could also try to replace the query Method in the dojox.rpc.JsonRest with this deferred = service(id); But i don't know how.

All these thoughts don't make me really happy and perhaps somebody has better ideas and in the best case a solution for me?

Thanks Philipp