Ag-Grid : How to get the focused cell value

孤街醉人 提交于 2020-01-14 09:19:05

问题


How to get the focused cell value at the time focussing on the cell by using the keyboard arrow keys


回答1:


You can either get the focused cell by using

var focusedCell = gridOptions.api.getFocusedCell();

or use the onCellFocused event.

Both give you the following properties:

  • rowIndex: number
  • column: Column

Use the row-index to retrieve the row-node:

var row = gridOptions.api.getDisplayedRowAtIndex(rowIndex);

After that you can use those properties to retrieve the raw value of the cell:

var cellValue = gridOptions.api.getValue(colKey, row.node)


来源:https://stackoverflow.com/questions/51385504/ag-grid-how-to-get-the-focused-cell-value

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!