How I can modify that example http://www.extjs.com/deploy/dev/examples/tree/reorder.html
for RESTful support?When we click on some node, it sends POST as "node=src/dd", but it doesn't work for RESTful.
It should be for example as "node/src_d开发者_如何学JAVAd", and GET will be nice.I found that ExtJS support RESTful for Store.
http://www.extjs.com/deploy/ext-3.0-rc2/examples/restful/restful.htmlThanks,
You'll have to create your own custom TreeLoader
class to construct the node names RESTfully in the url instead of passing 'node' as a param. As you can see from this example code, specifying your own TreeLoader
allows you to easily specify the HTTP request method.
root: new Ext.tree.AsyncTreeNode({
expanded: true,
loader: new Ext.tree.TreeLoader({
url: '/sample-data-toc.json',
requestMethod: 'GET',
preloadChildren: true
})
})
Dig into the TreeLoader
class and extend it to provide your own url scheme.
EDIT: after looking at the TreeLoader
source, it looks like you should override requestData
to properly set the url
based on the node
, and you'll probably want to change getParams
to either return nothing or any special query string params you have. Should not be too much work. When you're done, share back your RESTfulTreeLoader
with the community!
精彩评论