Reputation: 1
I want to display some of the properties of an Object in the AdvancedDataGrid. How can I do that? I want to declare DataGridColumn and bind it to respective propery of an object.I have an ArrayCollection which contains many object of type resolutionVO.
If i don't declare columns and provide that arrayCollection to dataProvider of DataGrid then it displays all the columns but i don't want all.
When i declare columns and bind dataField to the respective properties of that object then DataGrid displays empty data. Please help how do i need to bind it?
Below is my DataGrid :
<mx:AdvancedDataGrid id="resolutionDG" x="10" y="85" width="1153" height="300"
dataProvider="{filteredResolutionReport}" columnWidth="600" color="black">
<mx:columns >
<mx:AdvancedDataGridColumn width="200" headerText="Incident ID"
dataField="{((reportVO.resolutionReport as ArrayCollection).getItemAt(0) as ResolutionVO).incidentId}" editable="false" />
<mx:AdvancedDataGridColumn width="200" headerText="Priority"
dataField="{((reportVO.resolutionReport as ArrayCollection).getItemAt(0) as ResolutionVO).priority}" editable="true" />
<mx:AdvancedDataGridColumn width="200" headerText="SLM Status"
dataField="{((reportVO.resolutionReport as ArrayCollection).getItemAt(0) as ResolutionVO).SLMstatus}" />
<mx:AdvancedDataGridColumn width="200" headerText="Submit Date"
dataField="{((reportVO.resolutionReport as ArrayCollection).getItemAt(0) as ResolutionVO).submitDate}" />
<mx:AdvancedDataGridColumn width="200" headerText="Incident Resolved Date"
dataField="{((reportVO.resolutionReport as ArrayCollection).getItemAt(0) as ResolutionVO).incidentResolvedDate}" />
</mx:columns>
</mx:AdvancedDataGrid>
And actionScript part is :
[Bindable]
public var reportVO:ReportVO;
[Bindable]
public var resolutionReport:ArrayCollection;
[Bindable]
public var resolutionVO:ResolutionVO;
[Bindable]
public var filteredResolutionReport:ArrayCollection;
public function resultHandler(event:ResultEvent):void
{
resolutionReport=reportVO.resolutionReport;//
filteredResolutionReport=reportVO.resolutionReport;
}
And Classes are :
1)ReportVO.as
[Bindable]
[RemoteClass(alias="com.adobe.sla.valueObject.ReportVO")]
public class ReportVO
{
private var _resolutionReport:ArrayCollection;
private var _responseReport:ArrayCollection;
public function ReportVO()
{
}
public function get responseReport():ArrayCollection
{
return _responseReport;
}
public function set responseReport(value:ArrayCollection):void
{
_responseReport = value;
}
public function get resolutionReport():ArrayCollection
{
return _resolutionReport;
}
public function set resolutionReport(value:ArrayCollection):void
{
_resolutionReport = value;
}
}
2)ResolutionVO.as
[Bindable]
[RemoteClass(alias="com.adobe.sla.valueObject.ResolutionVO")]
public class ResolutionVO
{
private var _assignedGroup:String;
private var _incidentId:String;
private var _priority:String;
private var _SLMstatus:String;
public function ResolutionVO()
{
}public function get SLMstatus():String
{
return _SLMstatus;
}
public function set SLMstatus(value:String):void
{
_SLMstatus = value;
}
public function get priority():String
{
return _priority;
}
public function set priority(value:String):void
{
_priority = value;
}
public function get incidentId():String
{
return _incidentId;
}
public function set incidentId(value:String):void
{
_incidentId = value;
}
public function get assignedGroup():String
{
return _assignedGroup;
}
public function set assignedGroup(value:String):void
{
_assignedGroup = value;
}
}
Upvotes: 0
Views: 511
Reputation: 51
Hiii, you can declare your arraycollection as the dataprovider and it will keep updating.
Annotate ArrayCollection as [Bindable] in the
[Bindable] ArrayCollection gridData;
<mx:AdvancedDataGrid dataprovider={gridData}>
<mx:columns>
<mx:AdvancedDataGridColumn dataField="Album"/>
<mx:AdvancedDataGridColumn dataField="Price"/>
</mx:columns>
</mx:AdvancedDataGrid>
Hoe its helpful
Upvotes: 1
Reputation: 7193
You can define a 'virtual' field in your class ReportVO that does what your binding describes:
public function get virtualField():String {
return ResolutionVO(this.resolutionReport.getItemAt(0)).SLMstatus;
}
And then you bind it in your DatagridColumn:
<mx:AdvancedDataGridColumn width="200" headerText="Incident ID" dataField="virtualField" editable="false"/>
Upvotes: 0