View Full Version : Using setURL leads to multiple XHR loads

1 Mar 2007, 5:00 PM
I use the following fragment (method defined in my borderlayout object) to set an url for a given panel.

// load content from url to a given panel
loadContent : function(panel, url) {
var myp = layout.findPanel(panel);
if (myp) {

and call it like this:

NGGui.loadContent('center', 'settings/extensions/test.php')



The problem: If i switch between this panel and another panel, these panel does always load both scripts. I.e. i get two XHR request, one for test.php and one for tree_test.php. It seems they are ordered alphabetically, because test.php is always the one shown in the given panel.

I guess this is wrong, because setUrl should overwrite any existing URL, but not append an URL.

Although using firebug, i cannot see what is going wrong.

I am using alpha2

1 Mar 2007, 6:04 PM
You are getting two requests because you are making 2 calls. setUrl sets a url to load the content from when the panel is activated (and it handles the load for you when the panel is activated). refresh() manually does a refresh. So you are making 2 calls to server because you are telling it to load from the server on activation AND manually requesting a refresh.

2 Mar 2007, 3:46 AM
I understand this for the initial call of loadContent():

But, as i said: When switching the tab it does not perform 2 calls for the same script, but calls the two different scripts.

And i think this shoud not be. It should only perform a call for the last setting done with setUrl().

So in this example:
NGGui.loadContent('center', 'settings/extensions/test.php');

A switch on the tab panel (for example from 'center' to 'center1' should only call 'calls/tree_test.php' but not 'calls/tree_test.php' and 'settings/extensions/test.php'.

The myp.refresh() does not cause a second call to the same script.
If i omnit myp.refresh(), the panel does not get refreshed. It requires then an activation of the tab.

The problem persists and happens on activating the tab.

3 Mar 2007, 4:24 AM

if required, i can provide an example showing this effect.