3.0 beta 2

[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
July 27,
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
July 27,
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
July 27,
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
July 28,
Thanks alot for your help.....

It's asome product.

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

This topic is archived.

See also:


Back to support forum

Search

Version 2

Looking for AW 2.6 ?
The old site is here.