PDA

View Full Version : Why is extjs adding &node=root to my ajax url?



glafrance
19 Sep 2012, 10:08 AM
I'm trying to load a tree panel with data from the backend. Why is ExtJS adding &node=root to the url:

http://localhost:8080/mysvc/rest/api/?childDepth=all&_dc=1348077591545&node=root

This is breaking my service call.

glafrance
19 Sep 2012, 11:18 AM
Looks like something else was breaking my call, but still, why is that being added?

vietits
19 Sep 2012, 5:41 PM
When a store needs to load data for a node, it will generate a request with a parameter named 'node' that contains id of that node. In your case, the request for loading is GET and node id is 'root' (which is loading root node) then node=root is added to the url of requesting.

bjnelson62
3 Oct 2012, 5:07 AM
Yes, but more importantly, *why* does ExtJs do this?

In my case, the server I'm talking to doesn't need or want this information. There *should* be a way to disable it.

I found the nodeParam config on the TreeStore, but if I set it to "undefined", that just changes the text the Ajax request sends from "?node=..." to "?undefined=...". Not helpful.

It's my guess that there's no easy/convenient way to disable this behavior. I think it can be done by overriding some code in ExtJs that sends the request, but I shouldn't have to go to those lengths to do something *that* simple!

I'm fortunate in my case because my server seems to ignore everything after the question mark, but at some point I'll probably try to clean up the request just so it looks right.

This is an area where the documentation could save people a *lot* of grief. In the TreeStore, if it mentioned this behavior, where it comes from, why it's there, and how to disable it, that would be immensely helpful.

metalinspired
4 Oct 2012, 9:33 AM
I really don't see any reason to remove that from ExtJS.
If you coded your server-side code correctly it shouldn't pose any problem whatsoever.

bjnelson62
15 Oct 2012, 9:38 AM
I wasn't suggesting it be removed; that would be draconian. Instead, it'd be nice if there was a way to disable this behavior, because clearly not all situations require it.