【发布时间】:2015-11-19 09:50:45
【问题描述】:
我正在使用火花数据网格。 I want to emulate Excel Behaviour = When single cell is selected and users start to type on keyboard the selected cells goes to editing mode.我通过在第一个 keyDown 事件上启动 gridItemEditorSession 来做到这一点,但我遇到的问题是,在单元格中启动 gridItemEditorSession 值后,第二个 keyDown 删除了第一个 keyDown 字符;/
这里是演示: 只需选择任何单元格并开始输入:
<?xml version="1.0" encoding="utf-8"?>
<s:Application
xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark">
<fx:Script>
<![CDATA[
private function onKeyDown():void
{
trace(dataGrid.grid.anchorRowIndex)
trace(dataGrid.grid.caretRowIndex)
dataGrid.startItemEditorSession(dataGrid.grid.anchorRowIndex, dataGrid.grid.anchorColumnIndex)
}
private function onGridRollOver():void
{
}
]]>
</fx:Script>
<s:DataGrid id="dataGrid" requestedRowCount="5" width="350" editable="true"
height="300" selectionMode="multipleCells" keyDown="onKeyDown()"
gridRollOver="onGridRollOver()">
<s:ArrayCollection>
<s:DataItem key="1000" name="Abrasive" price="100.11" call="false"/>
<s:DataItem key="1001" name="Brush" price="110.01" call="true"/>
<s:DataItem key="1002" name="Clamp" price="120.02" call="false"/>
<s:DataItem key="1003" name="Drill" price="130.03" call="true"/>
<s:DataItem key="1004" name="Epoxy" price="140.04" call="false"/>
<s:DataItem key="1005" name="File" price="150.05" call="true"/>
<s:DataItem key="1006" name="Gouge" price="160.06" call="false"/>
<s:DataItem key="1007" name="Hook" price="170.07" call="true"/>
<s:DataItem key="1008" name="Ink" price="180.08" call="false"/>
<s:DataItem key="1009" name="Jack" price="190.09" call="true"/>
</s:ArrayCollection>
</s:DataGrid>
</s:Application>
【问题讨论】:
-
我看到我可以按预期编辑单元格中的值。您能否详细说明您的问题?
标签: actionscript-3 apache-flex flex4