发布时间:2025-12-10 19:28:09 浏览次数:20
自定义ItemEditor 组件「建议收藏」<!ThisisanitemeditorcomponentforDataGrid.ThedataProviderpropertyisoftypeArrayCollection,inthiscollection,theitemtypeisString.Iwastryingto…
是否还在为Ide开发工具频繁失效而烦恼,来吧关注以下公众号获取最新激活方式。亲测可用!
【正版授权,激活自己账号】:Jetbrains全家桶Ide使用,1年售后保障,每天仅需1毛
【官方授权 正版激活】:官方授权 正版激活 自己使用,支持Jetbrains家族下所有IDE…
<!— ThisisanitemeditorcomponentforDataGrid. ThedataProviderpropertyisoftypeArrayCollection,inthiscollection,theitemtypeisString. IwastryingtosettheitemtypeasObjectthatholdstwopropertieslike{id:1,value:‘Combox1’}. Consideringtothecommonality,Ipreferthisway,althoughImaywritemorecodesomwhere. Thiscomponentshouldbeoptimisedsometimetomakeitmoreflexiable. –> <mx:VBoxxmlns:mx=“http://www.adobe.com/2006/mxml” implements=“mx.controls.listClasses.IDropInListItemRenderer,mx.managers.IFocusManagerComponent”> <mx:Metadata> [Event(name=“comboxItemChange”,type=“common.CustomEvent”)] </mx:Metadata> <mx:Script> <![CDATA[ importcommon.CustomEvent; importmx.collections.ArrayCollection; importmx.controls.Alert; importmx.controls.dataGridClasses.DataGridItemRenderer; importmx.controls.dataGridClasses.DataGridListData; importmx.controls.listClasses.BaseListData; importmx.controls.listClasses.IDropInListItemRenderer; importmx.controls.listClasses.IListItemRenderer; importmx.controls.listClasses.ListData; importmx.core.IDataRenderer; importmx.events.ListEvent; [Bindable] publicvardataProvider:ArrayCollection=newArrayCollection(); privatevar_listData:DataGridListData; //Defineapropertyforreturningthenewvaluetothecell. [Bindable] publicvarvalue:Object; //ImplementthedrawFocus()methodfortheVBox. overridepublicfunctiondrawFocus(draw:Boolean):void { CB.setFocus(); } overridepublicfunctiongetdata():Object { returnsuper.data; } overridepublicfunctionsetdata(value:Object):void { super.data=value; CB.data=value[_listData.dataField]; } //flexinitializesthelistDatapropertyofthecomponent //withtheappropriatedatafromthelistcontrol publicfunctiongetlistData():BaseListData { return_listData; } publicfunctionsetlistData(value:BaseListData):void { _listData=DataGridListData(value); } protectedfunctionCB_changeHandler(event:ListEvent):void { this.dispatchEvent(newCustomEvent([this.data,value],“comboxItemChange”)); } ]]> </mx:Script> <mx:Bindingdestination=“value”source=“{CB.value}”/> <mx:ComboBoxid=“CB”editable=“false”dataProvider=“{dataProvider}”change=“CB_changeHandler(event)”/> </mx:VBox>转载于:https://blog.51cto.com/liumm/486579