国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 網站 > WEB開發 > 正文

7.5.創建一個Item Editor,它可以處理含有復雜數據類型的Data

2024-04-27 13:52:00
字體:
來源:轉載
供稿:網友
7.5.1.問題
如果item editor 收到的data 是一個用戶自定義對象,我們需要創建一個可以修改這個含有復雜類型對象的item editor。
7.5.2.解決辦法
創建一個item editor,它可以返回data 中所有己經被修改過的屬性。在List 上創建一個監聽器,用于對itemEditEnd 事件的監聽,在收到這個事件后要停止這個事件繼續上父級派發(flex 冒泡的事件機制),并讀取那個被修改過的item editor 中的data 屬性。
7.5.3.討論
List 類里有一個屬性叫editorDataField,如果你的editor 處理的是單個屬性,使用它將是最簡單最方便的選擇.但如果想用editor 處理含有多個屬性的復雜對象,必須能夠阻止List 、

DataGridColumn 的一些原有動作和事件,并且可以通過itemEditorInstance 讀到List、DataGridColumn 中的數據。

在下邊的例子中,processData 這個方法是用于處理itemEditEnd 事件的。
+展開
-XML
<mx:Canvas xmlns:mx="http://www.adobe.com/2006/mxmlwidth="700height="300">
<mx:Script>
<![CDATA[
import mx.events.ListEvent;
import mx.collections.ArrayCollection;
import oreilly.cookbook.MultipleDataTypeEditor;
[Bindable]
Private var arr:ArrayCollection = new ArrayCollection([{age:12, name:"Joe"},{age:16,name:"Jorge"},{age:19, name:"Jojo"}
,{age:2, name:"James"},{age:12, name:"Joaquin"}]);
public function processData(event:ListEvent):void {
// Disable copying data back to the control.
event.preventDefault();
// Get new label from editor.
list.editedItemRenderer.data= MultipleDataTypeEditor
(list.itemEditorInstance).data;
// Close the cell editor.
list.destroyItemEditor();
// Notify the list control to update its display.
list.dataProvider.notifyItemUpdate(list.editedItemRenderer);
}

]]>
</mx:Script>
<mx:List id="listitemEditor="oreilly.cookbook.MultipleDataTypeEditor"
dataProvider="{arr}itemEditEnd="processData(event)"
itemRenderer="oreilly.cookbook.MultipleDataTypeRenderer"
width="350editable="true">

</mx:List>
</mx:Canvas>
發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 军事| 怀宁县| 武威市| 外汇| 沿河| 霸州市| 山阳县| 郎溪县| 宁陕县| 南宁市| 寿阳县| 双江| 正定县| 罗田县| 德格县| 巩留县| 专栏| 延寿县| 泰州市| 上思县| 海原县| 武定县| 于都县| 闸北区| 女性| 大姚县| 井冈山市| 云林县| 城市| 涿鹿县| 泗洪县| 余庆县| 喜德县| 昌黎县| 翼城县| 特克斯县| 英德市| 钦州市| 崇左市| 秦安县| 平顺县|