Hi all... searched looooong and hard for this without luck:
I need to put a combobox in a column of a datagrid. The user just need to select a value from the existing combox items.
I know I need to use a custom cellrenderer. Please see my current attempt below.
This attempt successfully inserts a combobox into the datagrid, BUT without any data in the combobox. In fact, when I click on the combobox in the datagrid, it is the same as a normal combobox on the stage without a dataProvider. In other words, it doesn't even open.
Thus, I need to know how to modify my cellrenderer to correctly add the data to the combo and accept changes made by the user when selecting a value from the combobox.
Any help would be highly appreciated! Please note that I'm using AS3 and not AS2 and not Flex.
package {
import fl.controls.ComboBox;
import fl.controls.listClasses.ICellRenderer;
import fl.controls.listClasses.ListData;
import flash.events.Event;
import fl.data.DataProvider;
public class ComboBoxCell extends ComboBox implements ICellRenderer {
private var _listData:ListData;
private var _data:Object;
private var _selected:Boolean;
private var _mycombo:ComboBox = new ComboBox();
public function ComboBoxCell() {
_mycombo.addItem( { label:"MasterCard", data:0 } );
_mycombo.addItem( { label:"Visa", data:1 } );
_mycombo.addItem( { label:"American Express", data:2 } );
trace("drawn");
}
public function set data(d:Object):void {
_data = d;
}
public function get data():Object {
return _data;
}
public function set listData(ld:ListData):void {
_listData = ld;
}
public function get listData():ListData {
return _listData;
}
public function setMouseState(state:String):void{
}
public function get selected():Boolean{
return _selected;
}
public function set selected(value:Boolean):void{
_selected = value;
}
}
}