Home Tutorials Forums Articles Blogs Movies Library Employment Press

Go Back   ActionScript.org Forums > Extensions and Plugins > Components

Reply
 
Thread Tools Rate Thread Display Modes
Old 04-02-2007, 11:51 AM   #1
andrea_muta
Registered User
 
Join Date: Feb 2007
Posts: 16
Default Proper way to bind data to the DataGrid component - Best practices.

What's the correct way to bind data to a DataGrid component?

I am having some trouble to properly bind data to a DataGrid component, some .NET friends of mine showed me how easy it's for them, they just set the binding relation and it works quite smooth, the data is still there with the same row selected no matter if you poll the database every 5 seconds or click on the DataGrid header to change the sorting criteria, this is something that I haven't been able to achieve on Flash with the DataGrid control, I wonder if this control is really that difficult to use or if I am doing something wrong. I am for the latest.

The way I am using the DataGrid control is by setting its dataProvider property every time I poll the database, it looks similar to this...

PHP Code:
//Populate the DataGrid component.
//This method will be called every 5 seconds from
//a Webservice onResult callBack.
Populate_DataGrid(someDataFromWebserviceCall);
{
    
//Define an array to use it as a dataProvider for the dataGrid component.
    
var myDataGrid_Data_Array = new Array();
    
    
//Bind the array of data to the DataGrid's dataProvider property.
    
myDataGridComponent.dataProvider myDataGrid_Data_Array;

    for (
i in someDataFromWebserviceCall)
    {
        
//Extract data from a hypothetical Webservice response...
        
var tmp_Data someDataFromWebserviceCall[i];
        
        
//...and add the data to the array of data which was
        //binded to the dataProvider property.
        
myDataGrid_Data_Array[i] = tmp_Data;
    }

I see what I am doing wrong in here and I don't know another way to do it, it must be another way. The problem is that I am re-setting the data array every time I poll for new data and so, for the DataGrid component it looks like new data every time I get data, it's not like updating data.

I have been reading about using the DataSet component, populating this component with the data, binding its dataProvider to the DataGrid's dataProvider and some use of the deltaPacket property but, honestly, I don't know how to do it.

If someone could summarise -schematically, I don't need detailed code- how to properly show data on a DataGrid which update repeatedly, where the final user can operate it to change the sorting criteria without loosing any selected row, that will be fantastic. Or point me out to the right document, article, link, something that could help me on making a good use of this component.

I know that many questions has been asked about the DataGrid component and I think that most of those are related to the same bottom line problem, that this component is not been used properly, we are missing something in here.

Thank you very much for any help.
andrea_muta is offline   Reply With Quote
Old 04-03-2007, 09:13 AM   #2
andrea_muta
Registered User
 
Join Date: Feb 2007
Posts: 16
Default Proper way to bind data to the DataGrid component - Best practices.

What's the correct way to bind data to a DataGrid component?

I am having some trouble to properly bind data to a DataGrid component, some .NET friends of mine showed me how easy it's for them, they just set the binding relation and it works quite smooth, the data is still there with the same row selected no matter if you poll the database every 5 seconds or click on the DataGrid header to change the sorting criteria, this is something that I haven't been able to achieve on Flash with the DataGrid control, I wonder if this control is really that difficult to use or if I am doing something wrong. I am for the latest.

The way I am using the DataGrid control is by setting its dataProvider property every time I poll the database, it looks similar to this...

PHP Code:
//Populate the DataGrid component.
//This method will be called every 5 seconds from
//a Webservice onResult callBack.
Populate_DataGrid(someDataFromWebserviceCall);
{
    
//Define an array to use it as a dataProvider for the dataGrid component.
    
var myDataGrid_Data_Array = new Array();
    
    
//Bind the array of data to the DataGrid's dataProvider property.
    
myDataGridComponent.dataProvider myDataGrid_Data_Array;

    for (
i in someDataFromWebserviceCall)
    {
        
//Extract data from a hypothetical Webservice response...
        
var tmp_Data someDataFromWebserviceCall[i];
        
        
//...and add the data to the array of data which was
        //binded to the dataProvider property.
        
myDataGrid_Data_Array[i] = tmp_Data;
    }

I see what I am doing wrong in here and I don't know another way to do it, it must be another way. The problem is that I am re-setting the data array every time I poll for new data and so, for the DataGrid component it looks like new data every time I get data, it's not like updating data.

I have been reading about using the DataSet component, populating this component with the data, binding its dataProvider to the DataGrid's dataProvider and some use of the deltaPacket property but, honestly, I don't know how to do it.

If someone could summarise -schematically, I don't need detailed code- how to properly show data on a DataGrid which update repeatedly, where the final user can operate it to change the sorting criteria without loosing any selected row, that will be fantastic. Or point me out to the right document, article, link, something that could help me on making a good use of this component.

I know that many questions has been asked about the DataGrid component and I think that most of those are related to the same bottom line problem, that this component is not been used properly, we are missing something in here.

Thank you very much for any help.
andrea_muta is offline   Reply With Quote
Reply


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
one template, many looks? subquark ActionScript 1.0 (and below) 1166 10-29-2013 06:18 PM
data from shared object into datagrid not working gabrielthegrey Components 0 10-01-2005 12:24 AM
progress bar to run while a datagrid is being populated with data srija Components 0 09-06-2005 05:33 PM
Database simulated with arrays on a cd-rom lecasn5 Components 61 09-07-2004 11:40 AM
Using the DataGrid component with an XML Andy.burnett ActionScript 1.0 (and below) 2 12-23-2002 10:39 AM


All times are GMT. The time now is 04:03 PM.

///
Follow actionscriptorg on Twitter

 


Powered by vBulletin® Version 3.8.5
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Ad Management plugin by RedTyger
Copyright 2000-2013 ActionScript.org. All Rights Reserved.
Your use of this site is subject to our Privacy Policy and Terms of Use.