:: Forum >>

[no subject]

Hi.

I need some help again....

I have a "load information " button and a tab.

When the button is clicked I want to update the tab and then do a table request to the server in this order. (I want the text "loading" at the tab.)

But: The request to the server is always first and then the update of the tab.

How can I change the order, so the tab is updated first and then the request to the server is sent.



Oddbjørn
Friday, July 27, 2007
setTimeout("serverCall()", [a small amount of time]);

Try that - It will delay the server call until the amount of time (in ms) is up. From there use trial and error, I'd say.
Justin
Friday, July 27, 2007
I did try that, but it did the call, but no delay.

mybutton.onClick=function (){
--(tab update)
this.Timeout(funcGetRequest,100000);
}

I tried with alot of numbers for time(ms), but I did not get any delay.

Any solutions??

I don't know trial and error. Any eksampel??
Oddbjørn
Friday, July 27, 2007
Are you restoring the tab text too soon? You need to restore the tab text in the call back function of the get data request. I think the following simulates what you are trying to do.
<html>
<head>
<title>Test Tabs</title>
<link rel="stylesheet" href="../activewidget/runtime/styles/aqua/aw.css" type="text/css" />
<script language="javascript" type="text/javascript" src="../activewidget/runtime/lib/aw.js"></script>
</head>
<boby>
<script>
var tabs = new AW.UI.Tabs;
tabs.setItemText(["Home", "Favorites", "Font size", "Search"]);
tabs.setItemImage(["home", "favorites", "fontsize", "search"]);
tabs.setItemCount(4);
tabs.setSelectedItems([0]);
document.write(tabs);
</script>
<p/>
<script>
var btn = new AW.UI.Button;
btn.setControlText("Button");
btn.setControlImage("favorites");
document.write(btn);
var saveTabText
btn.onClick = function(event) {
    var currentItem = tabs.getCurrentItem();
    saveTabText = tabs.getItemText(currentItem)
    tabs.setItemText("loading...", currentItem)
    // simulate call to get data (
    window.setTimeout(callbackComplete, 1000);
    // dont do this - restores text to early
// tabs.setItemText(saveTabText, currentItem)
}
// this is the get data callback complete function (i.e. data now loaded)
function callbackComplete() {
    var currentItem = tabs.getCurrentItem();
    tabs.setItemText(saveTabText, currentItem)
}
</script>
</body>
Bryn
Saturday, July 28, 2007
Thanks alot for your help.....

It's asome product.

And I'll be back
Oddbjørn
Wednesday, August 22, 2007

This topic is archived.


Back to support forum

Forum search