mardi 28 février 2017

How to use the replaceItemAt method for a datagrid in Actionscript 3 Flash to update dataproviders in an array?

In a Flash CS6 project, I have an array with 5 separate dataproviders that supplies the data for an editable datagrid called priceGrid.

 var priceGrid:DataGrid = new DataGrid();
 var enterPriceDataProviderArray:Array = new Array(new DataProvider(), new DataProvider(), new DataProvider(), new DataProvider(), new DataProvider());

 priceGrid.dataProvider = enterPriceDataProviderArray[arrayIndex];

I have an event listener for when the user edits a specific cell in the datagrid with one of the dataproviders supplying data, the global variable credit is updated.

 credit = priceGrid.columns[5].itemToLabel(priceGrid.getItemAt(0));

I would like to be able to update the other dataproviders in the array with the new value of credit that the user changed. In this way, I'm hoping that the datagrid will update with the new value of credit irrespective of whichever dataprovider supplies the data. The address in the datagrid is the same for all the other data providers.

Can I use the replaceItemAt method to be able to do this? Can someone please give me an example code of what this would look like?

Aucun commentaire:

Enregistrer un commentaire