:: Forum >>

How ca i determine when the data has been recived???

I need to find out when the Active.Text.Table has finished loading the data into the grid ?(I recive the data asynchronous.)
I need a answer fast
Thanks
Plastik
Thursday, April 8, 2004
You can plug your code into the table.response method.

var table = new Active.Text.Table;
...
var defaultResponse = table.response;

table.response = function(data){
defaultResponse.call(table, data);
// do your stuff here
}

...
table.request();

Actually, the data is not loaded into the grid. The model just provides an interface to retrieve the data when needed.
Alex (ActiveWidgets)
Thursday, April 8, 2004
So the place with "//do your stuff here."
How would you code, stop here until the table is finished loading.? I'm loading two XML tables, and I need the first one loaded before the seconds one can even start... Is that how I would do it?
Dave
Monday, October 4, 2004
The data model sends a request to the server when you call table.request() method. Nothing happens until the response comes back and at this time the data model calls table.response() method. If you insert your code into the response method it will be called after the data had arrived. At this point you can set up your second table and call the table2.request().
Alex (ActiveWidgets)
Monday, October 4, 2004
Excellent. All I did was say to load my dropdown boxes after the data for the dropdown boxes has loaded. Its all starting to make sense now.

<script>
    var tableOrder = new Active.XML.Table;
    var tableReason = new Active.XML.Table;
    var tableComp = new Active.XML.Table;

    tableOrder.setRows("//root/OrderStatusCodes");
    tableReason.setRows("//root/ReasonCodes");
    tableComp.setRows("//root/Competitors");

    tableOrder.setURL("http://********/Get_Codes.xml");

    var _response = tableOrder.response;
    tableOrder.response = function(xml)
    
{
        _response.call(this, xml);
        tableReason.setXML(xml);
        tableComp.setXML(xml);

        for (i = 0; i <=tableOrder.getCount(); i++){
            dropBox1.addOption(tableOrder.getText(i, 1), tableOrder.getText(i, 0), 9);
        }

        for (i = 0; i <=tableReason.getCount(); i++){
            dropBox2.addOption(tableReason.getText(i, 1), tableReason.getText(i, 0), 10);
        }

        for (i = 0; i <=tableComp.getCount(); i++){
            dropBox3.addOption(tableComp.getText(i, 1), tableComp.getText(i, 0), 11);
        }

    obj.setColumnTemplate(dropBox1,9);
    obj.setColumnTemplate(dropBox2,10);
obj.setColumnTemplate(dropBox3,11);
    }

    tableOrder.request();
</script>
Dave
Tuesday, October 5, 2004

This topic is archived.


Back to support forum

Forum search