lecosson / assql

Automatically exported from code.google.com/p/assql
0 stars 0 forks source link

Suggestion for alternate example #61

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Here's a more comprehensive example how to set up a DataGrid to stream
results in real time:

grid = new DataGrid();
grid.columns = [new DataGridColumn("Row1"), new DataGridColumn("Row2")];    
grid.dataProvider = new ArrayCollection();                  

// make the query

var rows_available:int = 0;
token.addEventListener(MySqlEvent.ROWDATA, function(e:MySqlEvent):void {
   rs = e.resultSet;                    
   if (rs.first()) {
    for (var i:int = 0; i < rows_available; i++) rs.next();             // only tack on
the new rows that just came in      
    do {                                           grid.dataProvider.addItem( { Row1:
rs.getString("Row1"), Row2: rs.getString("Row2") } );       
        } while (rs.next());
        rows_available = e.rowsAvailable;
    }
});             

Original issue reported on code.google.com by will.per...@gmail.com on 10 Aug 2008 at 8:37

GoogleCodeExporter commented 9 years ago
Thanks for the suggestion!

I have updated the Example page to reflect something similar to what you have 
provided.

Original comment by macl...@gmail.com on 14 Aug 2008 at 5:47