0
我在Flex s:DataGrid/>
中遇到了一個奇怪的問題。 gridItemEditorSessionSave
事件爲我觸發兩次。最小代碼重現這個問題如下:Flex Spark DataGrid GridItemEditorSessionSave事件問題
<?xml version="1.0" encoding="utf-8"?>
<s:WindowedApplication 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:Declarations>
<s:ArrayCollection id="dp">
<fx:Object test="Test"/>
</s:ArrayCollection>
</fx:Declarations>
<fx:Script>
<![CDATA[
import spark.events.GridItemEditorEvent;
protected function onGridItemEditorSessionSave(event:GridItemEditorEvent):void
{
trace("Edited >>>", event.columnIndex);
}
protected function onGridItemEditorSessionStart(event:GridItemEditorEvent):void
{
trace("Edit Start >>>", event.columnIndex);
}
]]>
</fx:Script>
<s:DataGrid dataProvider="{dp}" width="100%" height="100%" editable="true"
gridItemEditorSessionSave="onGridItemEditorSessionSave(event)"
gridItemEditorSessionStart="onGridItemEditorSessionStart(event)">
<s:columns>
<s:ArrayCollection>
<s:GridColumn dataField="test"/>
</s:ArrayCollection>
</s:columns>
</s:DataGrid>
</s:WindowedApplication>
當我編輯該單元格,跟蹤語句如下:
Edit Start >>> 0 Edited >>> 0 Edited >>> 0
這表明onGridItemEditorSessionSave
觸發兩次!不知道我錯過了什麼。
任何幫助表示感謝,提前致謝!