我有一些DataGrids与非常标准的单行itemrenderers,但需要为整行使用自定义的两行itemeditor。我想/必须这样做,因为我无法单独编辑每个单元格,但需要在保存之前编辑整个对象。
到目前为止,我遇到了两个大问题:
基本上,我想要的是:
MyDataGrid:
<s:DataGrid id="myDataGrid" height="100%" width="100%" sortableColumns="false" editable="true" variableRowHeight="true">
<s:columns>
<s:ArrayCollection>
<s:GridColumn dataField="foo" itemEditor="myItemEditor"/>
<s:GridColumn dataField="bar" itemEditor="myItemEditor"/>
<s:GridColumn width="24" itemRenderer="myItemRenderer"/>
</s:ArrayCollection>
</s:columns>
</s:DataGrid>
MyItemEditor:
<?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">
<fx:Script>
<![CDATA[
override public function prepare():void {
itemLongname.text = this.data["longName"];
itemShortname.text = this.data["shortName"];
}
]]>
</fx:Script>
<s:layout>
<s:VerticalLayout/>
</s:layout>
<s:Group>
<s:layout>
<s:HorizontalLayout/>
</s:layout>
<s:TextInput id="itemLongname"/>
<s:TextInput id="itemShortname"/>
</s:Group>
<s:Group>
<s:layout>
<s:HorizontalLayout/>
</s:layout>
<s:Rect width="100%"/>
<s:Button id="itemSaveButton" label="Save"/>
<s:Button id="itemCancelButton" label="Cancel"/>
</s:Group>
</s:GridItemEditor>
答案 0 :(得分:1)
答案 1 :(得分:0)