3 Replies Latest reply on Feb 9, 2007 10:00 AM by arkcto

    Delaying grid display until data loaded


      I have a data grid that gets the data from a remote object call. I realize that this is an asynchronuos call. The grid currently just opens immediately with an empty grid, and then I have to reopen it(only takes 2 secs for call to complete) to show the data.

      I've tried using empty loops (count i from 1 to 10000, put busy cursors) but for some reason the grid always opens immediately. Is there a way to delay the display of the grid until all the display is loaded.

        • 1. Re: Delaying grid display until data loaded
          ur_dtrain Level 1
          Simple set the the default visibility to visible="false", then in your result handler once the data is received, toggle it to true. Something that is not visible can still have its dataProvider set .
          • 2. Delaying grid display until data loaded
            arkcto Level 1
            Hi Darin,

            Unfortunately that doesn't solve the problem. What you suggested will just make it invisible and then visible, but the datagrid doesn't refresh during that time. I mean the data is being loaded, but I have to close and reopen the grid. You know what I mean ?

            Also for some reason, even when I waited for the data to be loaded, the grid is still empty.

            My code is :

            public var data:ArrayCollection;
            public var grid:

            GridDataRemoteObject.getData(username); // The call to the remote object - this sets the data variable internally.

            while (data == null) {
            ; // While data is null, do nothing. When its loaded, get out of the loop

            grid.dataProvider = data;

            // fill columns
            var column1:DataGridColumn = new DataGridColumn("column1");
            var column2:DataGridColumn = new DataGridColumn("column2");
            var column3:DataGridColumn = new DataGridColumn("column3");
            var columns:Array = new Array(column1, column2, column3);
            grid.columns = columns;

            Unfortunately after all this, I get an empty data grid. Either that or I time out i.e. it takes longer than the default 15 secs in
            the while loop. Mind you if i re-open grid, i can see it fine. But unfortunately i want to show only when data is loaded without having to reopen grid, and i haven't been able to do so.

            Help please...

            • 3. Re: Delaying grid display until data loaded
              arkcto Level 1
              Problem solved.

              Moved datagrid code to the "result method".