PDA

View Full Version : TreeLoader doesn't pass params using GET in 3.1



J. Brisbin
21 Dec 2009, 11:45 AM
Just upgraded to 3.1 the other day and I'm working on a new maintenance application. I'm integrating a new REST-based Groovy server framework and it enforces proper REST by routing requests to Groovy closures based on the HTTP method.

When I create a TreeLoader with the dataUrl of my REST API url and open a node, I have to have the logic of retrieving the children in my my "create" closure because HTTP POST in REST means "create a new object". When I set the requestMethod to "get" in my TreeLoader, it doesn't pass my params at all. Not sure if this is intentional or a bug. Surely I don't have to have special event listeners on my TreeLoader just because I'm trying to enforce proper REST behavior throughout my app?

Thanks for the help...



var treePanel = new Ext.tree.TreePanel({
id: "itemtree",
renderTo: "item-pnl-right",
useArrows: true,
animate: true,
enableDD: true,
containerScroll: true,
loader: new Ext.tree.TreeLoader({
dataUrl: "/rest/api/_ad/menu/tree",
requestMethod: "get",
nodeParameter: "parent"
}),
root: {
nodeType: "async",
text: "Webportal Menu",
draggable: false,
id: "0"
}
});
treePanel.getRootNode().expand();

art.home.ext
21 Dec 2009, 1:40 PM
/**
* @property method
* The default HTTP method to be used for requests. Note that this is case-sensitive and
* should be all caps (defaults to undefined; if not set but params are present will use
* "POST", otherwise will use "GET".)
* @type String
*/

did you try

requestMethod:'GET',
instead ?

J. Brisbin
21 Dec 2009, 2:16 PM
did you try

requestMethod:'GET',
instead ?

After about an hour spent debugging and getting to the spot in the code where it checks the request method, I found this out. :)