简体   繁体   中英

Flex datagrid with dropdownlist in a particular row

I'm having difficulty figuring out how to add a dropdownlist control to only a single row of a data grid. For example, if I have two rows of data in the grid, I want the top to be the normal text from the data provider, and the second row to be a dropdownlist (bound to an array collection). I've searched high and low for a solution to no avail. Any help is much appreciated.

Thanks,

Conceptually you need an itemRenderer function, which is not implemented in the MX DataGrid. ( It may be in the new Spark one, but I don't know).

In lieu of that, just create an itemRenderer to conditionally display the DropDownList. Something like this:

<s:MXDataGridRenderer dataChange="onDataChange()">
 <fx:script>
   public function onDataChange():void{
    if((this.ListData as DataGridListData).rowIndex == 0){
     label.visible == false;
     ddl.visible == true;
    } else {
     label.visible == true;
     ddl.visible == false;
    }   
   }
 </fx:Script>

 <s:Label id="label" />
 <s:DropDownList id="ddl" />

</s:MXDataGridRenderer>

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