flex4.5 DataGrid控制某行不可编辑
发布时间:2020-12-15 04:45:52 所属栏目:百科 来源:网络整理
导读:网上关于flex4.5的DataGrid例子很少,自己做的时候也遇到了很多问题。 应用程序中的DataGrid:(要用自定义的itemEditor) ? s:DataGrid id="osinfoData" width="100%" height="100%" alternatingRowColors="[#eeffff,#ffffff]" editable="true" dataProvide
网上关于flex4.5的DataGrid例子很少,自己做的时候也遇到了很多问题。 应用程序中的DataGrid:(要用自定义的itemEditor) ? <s:DataGrid id="osinfoData" width="100%" height="100%" alternatingRowColors="[#eeffff,#ffffff]" editable="true" dataProvider="{infoproperties}"> <s:columns> <s:ArrayList> <s:GridColumn headerText="名称" dataField="name" editable="false"/> <s:GridColumn headerText="值" dataField="value" editable="true" itemEditor="com.control.itemeditor.DataGridEditItemEditor"/> </s:ArrayList> </s:columns> </s:DataGrid>
var infoproperties:ArrayCollection=new ArrayCollection(); infoproperties.addItem({name:"id",value:"1",edit:false}); infoproperties.addItem({name:"名称",edit:true}); infoproperties.addItem({name:"xml名称",edit:true}); infoproperties.addItem({name:"注释",edit:true}); infoproperties.addItem({name:"创建时间",value:"2012-10-12 08:00:00",edit:false}); infoproperties.addItem({name:"创建人",value:"me",edit:false}); infoproperties.addItem({name:"最后修改时间",edit:false}); infoproperties.addItem({name:"最后修改人",edit:false}); 自定义DataGridEditItemEditor.mxml <?xml version="1.0" encoding="utf-8"?> <s:GridItemEditor xmlns:fx=http://ns.adobe.com/mxml/2009 xmlns:s="library://ns.adobe.com/flex/spark" xmlns:mx="library://ns.adobe.com/flex/mx" clipAndEnableScrolling="true"> <fx:Script> <![CDATA[ public var newValue:String; override public function set data(value:Object):void{ super.data=value; txt.text=data.value; txt.editable=data.edit; } ]]> </fx:Script> <s:TextInput id="txt" alpha="1" width="100%" height="100%" change="super.value = txt.text" updateComplete="newValue=txt.text;"/> </s:GridItemEditor>
(编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |