简体   繁体   中英

Is it possible for a datagrid with a dataprovider to have one column with a different dataprovider?

I have a datagrid, which gets filled by an ArrayList. I want one column to be filled by another ArrayList. I've tried doing it like this, but that only gets the first three columns filled, not the last one (with the different ArrayList):

<s:DataGrid x="10" y="281" width="597" height="204" dataProvider="{arEvents}"
            requestedRowCount="4">
    <s:columns>
        <s:ArrayList>
            <s:GridColumn dataField="title" headerText="Column 1" ></s:GridColumn>
            <s:GridColumn dataField="venue.location.geopoint" headerText="Column 2"></s:GridColumn>
            <s:GridColumn dataField="startDate" headerText="Column 3"></s:GridColumn>
            <s:GridColumn dataField="{arArtistsPerEvent}" headerText="Column 3"></s:GridColumn>
        </s:ArrayList>
    </s:columns>
</s:DataGrid>

No, it is not possible. That would break the very purpose of a datagrid and dataprovider.

One solution would be to parse the second list and put its values in the first one.

for(var i:int=0; i<arArtistsPerEvent.length; i++) {
    arEvents.getItemAt(i).artistsPerEvent=arArtistsPerEvent.getItemAt(i);
}

and then have the dgColumn like

<s:GridColumn dataField="artistsPerEvent" headerText="Column 3"></s:GridColumn>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM