Data binding with DataGrid via ActionScript

I am trying to link the result of an ArrayCollection coming from the server to my DataGrid dynamically created in AS.

Result data is not displayed in the grid.

var dg:DataGrid = new DataGrid();
dg.width=650; 
dg.dataProvider=someArrayCollfromServer;

I add dgColumn as a runtime based on some data from XML, and this is the same as defined in a more static format.

But if I use the same code and create the DataGrid as a Flex component, as shown below, it works fine.

<mx:DataGrid id="dg" width="100%" height="100%" dataProvider="{someArrayCollfromServer}">
<mx:columns>
<mx:DataGridColumn dataField="Value" headerText="Value"/>
<mx:DataGridColumn dataField="Code" headerText="Code" />
</mx:columns>
</mx:DataGrid>

It works great. Is there any functionality or implementation that is different from DataGrid in Flex and AS.

Any problem here?

+3
source share
1 answer

dg.dataProvider=someArrayCollfromServer; someArrayCollfromServer ( , ) dataProvider. , :

BindingUtils.bindProperty(dg, "dataProvider", this, "someArrayCollfromServer");

, someArrayCollfromServer [Bindable]

+2

Source: https://habr.com/ru/post/1752209/


All Articles