PDA

View Full Version : Data Grid - Update Column with variable (not from data provider)


Digitalosophy
07-27-2009, 06:45 PM
Hello,

I have a data grid who's data provider is set to an XML object.


<mx:DataGrid id="streamMonitorGrid" dataProvider="{_data.stream}" height="100%" width="100%">
<mx:columns>
<mx:DataGridColumn headerText="Title" dataField="@title"/>
<mx:DataGridColumn headerText="StationId" dataField="@stationId"/>
<mx:DataGridColumn headerText="Net Connection Status" id="nconnStatus" />
</mx:columns>
</mx:DataGrid>




Title and StationId data is set to XML attributes from the XMLObject and display with no problem.

The issue that I have ran into is I want to set the 3rd column (marked as "Net Connection Status") to a variable outside of the data provider XML object. The 3rd column should be set to any variable that I want - not within the XML object.

I cannot figure how to do the above, it almost seems like once a data provider is set you can't set a column to anything but data within the data provider.

Any idea's?

TIA

Peter Cowling
07-27-2009, 07:08 PM
It is accurate to say that datagrid is developed with the idea that it will be driven by data.

Although there are options, I would not be keen use them.

Still, if you want to go outside of your dataprovider, you can, for example, use an itemrenderer, and override set data; you can then pull in whatever data you need at that point. You could also extend datagridcolumn, and maybe a couple of other things.