2009-08-21 93 views
2

我想在Flex中的高級數據網格中實現類似Excel的鍵盤(箭頭)導航。 http://livedocs.adobe.com/flex/3/html/help.html?content=advdatagrid_11.html 的記錄中指出可以使用箭頭鍵在單元格周圍導航。但是,在我的情況下,這是行不通的。我只能瀏覽行上下Flex中的鍵盤導航Datagrid

---剪斷---

當焦點位於AdvancedDataGrid控件:

* Use the Left, Right, Up, and Down Arrow keys to move between cells. 
* Use the Shift+Home and Shift+End keys to move to the first and last column in current row. 
* Cells are only selected by default, they are not editable. 
* Press the F2 key to make a cell editable. 

---扣---

任何關於這個的想法?

THX, 馬丁

回答

3

默認情況下,您可以選擇在AdvancedDataGrid一整行。您需要將選擇模式更改爲單個單元格。然後,所有的箭頭將工作

<mx:AdvancedDataGrid id="myADG" 
         width="100%" 
         height="100%" 
         color="0x323232" 
         selectionMode="singleCell" 
         initialize="gc.refresh();"> 
+0

嗨菲爾, 謝謝!這很好 - 不知道我可以設置這個屬性。 現在,我可以使用遊標導航 - 您是否可以通過開始輸入/按下回車鍵來實現該功能?我可以開始編輯單元格嗎?一些keydownhandler? 謝謝 – Martin 2009-08-21 10:01:23

1

  • 大多數Flex可視「你一個suggstion如何,我可以通過開始輸入/按下回車鍵我就可以開始編輯單元格?有些keydownhandler implemente說」組件從UIComponent繼承。 UIComponent定義了一個keyDownHandler,它首先被調用來處理鍵盤操作。您可以在ADG的擴展名中覆蓋此項,並檢查鍵盤輸入是否爲字母數字。如果是這樣,您可以通過設置editedItemPosition來開始編輯會話。希望這可以幫助!