I am currently trying to disable selection / editable / or change textInput to dynamic to get the desired result.
I have a custom datagrid with drop-down lists and text input areas. However, if there is no data in my Model # column, I donβt want to allow entry in the corresponding PurchasePrice cell.
col1 = new DataGridColumn("Model"); col1.headerText = "Model #"; c2.consumables_dg.addColumn(col1); col1.width = 60; col1.editable = false; col1.sortable = false; col1.cellRenderer = AlternatingRowColors_editNum_PurchasePrice; col1 = new DataGridColumn("PurchasePrice"); col1.headerText = "Purchase Price"; c2.consumables_dg.addColumn(col1); col1.width = 60; col1.editable = false; col1.sortable = false; col1.cellRenderer = AlternatingRowColors_editNum_PurchasePrice;
I tried various elements in AlternatingRowColors_editNum_PurchasePrice, but nothing works yet. See what I tried in my statement else if (__ enbaled)
package{ import flash.text.TextFormat; import flash.text.TextFormatAlign; import fl.controls.TextInput; import flash.text.TextFieldType; import flash.events.Event; import fl.controls.listClasses.ListData; import fl.controls.listClasses.ICellRenderer; public class AlternatingRowColors_editNum_PurchasePrice extends TextInput implements ICellRenderer { protected var _data:Object; protected var _listData:ListData; protected var _selected:Boolean; private var __enabled:Boolean = false; public static var _stage; public static var _alignment; private var tf:TextFormat; public function AlternatingRowColors_editNum_PurchasePrice() { tf = new TextFormat(); if(__enabled){ if(_alignment == 2){ tf.align = TextFormatAlign.RIGHT; }else if(_alignment == 1){ tf.align = TextFormatAlign.CENTER; }else{ tf.align = TextFormatAlign.LEFT; } restrict = "0-9."; addEventListener(Event.CHANGE, textChange); }else{
Am I just getting it wrong? Instead of trying to stop the mouse, tab, or convert the text box to dynamic, should I try something else to get the desired result?
Thanks x
source share