convert remote object result to array collection in flex...........

Posted by user364199 on Stack Overflow See other posts from Stack Overflow or by user364199
Published on 2010-06-11T04:31:45Z Indexed on 2010/06/11 4:43 UTC
Read the original article Hit count: 288

Filed under:
|
|

HI guys, im using zend_amf and flex. My problem is i have to populate my advance datagrid using array collection. this array collection have a children.

example:

    [Bindable]
 private var dpHierarchy:ArrayCollection = new ArrayCollection([
  {trucks:"Truck", children: [
         {trucks:"AMC841", total_trip:1, start_time:'3:46:40 AM'},
         {trucks:"AMC841", total_trip:1, start_time:'3:46:40 AM'}])
         ]};

but the datasource of my datagrid should come from a database, how can i convert the result from remote object to array collection that has the same format like in my example, or any other way.

here is my advance datagrid

<mx:AdvancedDataGrid id="datagrid"
                         width="500" height="200" lockedColumnCount="1" lockedRowCount="0" horizontalScrollPolicy="on" includeIn="loggedIn" x="67" y="131">
        <mx:dataProvider>
            <mx:HierarchicalData id="dpHierarchytest" source="{dp}"/>
        </mx:dataProvider>
        <mx:groupedColumns>
            <mx:AdvancedDataGridColumn dataField="trucks"
                                       headerText="Trucks"/>
            <mx:AdvancedDataGridColumn dataField="total_trip"
                                       headerText="Total Trip"/>
            <mx:AdvancedDataGridColumnGroup headerText="PRECOOLING">
                <mx:AdvancedDataGridColumnGroup headerText="Before Loading">
                    <mx:AdvancedDataGridColumn dataField="start_time" headerText="Start Time"/>
                    <mx:AdvancedDataGridColumn dataField="end_time" headerText="End Time"/>
                    <mx:AdvancedDataGridColumn dataField="precooling_time" headerText="Precooling Time"/>
                    <mx:AdvancedDataGridColumn dataField="precooling_temp" headerText="Precooling Temp"/>
                </mx:AdvancedDataGridColumnGroup>
                <mx:AdvancedDataGridColumnGroup headerText="Before Dispatch">
                    <mx:AdvancedDataGridColumn dataField="bd_start_time" headerText="Start Time"/>
                    <mx:AdvancedDataGridColumn dataField="bd_end_time" headerText="End Time"/>
                    <mx:AdvancedDataGridColumn dataField="bd_precooling_time" headerText="Precooling Time"/>
                    <mx:AdvancedDataGridColumn dataField="bd_precooling_temp" headerText="Precooling Temp"/>
                </mx:AdvancedDataGridColumnGroup>
                <mx:AdvancedDataGridColumn dataField="remarks"
                                           headerText="Remarks"/>
            </mx:AdvancedDataGridColumnGroup>
            <mx:AdvancedDataGridColumnGroup headerText="Temperature Compliance">
                <mx:AdvancedDataGridColumn dataField="total_hit" headerText="Total Hit"/>
                <mx:AdvancedDataGridColumn dataField="total_miss" headerText="Total Miss"/>
                <mx:AdvancedDataGridColumn dataField="cold_chain_compliance" headerText="Cold Chain Compliance"/>
                <mx:AdvancedDataGridColumn dataField="average_temp" headerText="Average Temp"/>
            </mx:AdvancedDataGridColumnGroup>
            <mx:AdvancedDataGridColumnGroup headerText="Productivity">
                <mx:AdvancedDataGridColumn dataField="total_drop_points" headerText="Total Drop Points"/>
                <mx:AdvancedDataGridColumn dataField="total_delivery_time" headerText="Total Delivery Time"/>
                <mx:AdvancedDataGridColumn dataField="total_distance" headerText="Total Distance"/>
            </mx:AdvancedDataGridColumnGroup>
            <mx:AdvancedDataGridColumnGroup headerText="Trip Exceptions">
                <mx:AdvancedDataGridColumn dataField="total_doc" headerText="Total DOC"/>
                <mx:AdvancedDataGridColumn dataField="total_eng" headerText="Total ENG"/>
                <mx:AdvancedDataGridColumn dataField="total_fenv" headerText="Total FENV"/>
                <mx:AdvancedDataGridColumn dataField="average_speed" headerText="Average Speed"/>
            </mx:AdvancedDataGridColumnGroup>
        </mx:groupedColumns>
    </mx:AdvancedDataGrid>

Thanks, and i really need some help.

© Stack Overflow or respective owner

Related posts about php

Related posts about flex