new*_*wbo 3 javascript ag-grid
我有一个农业网格,我需要能够通过键盘进行编辑。我将 editType 设置为 fullRow,并且希望能够添加 javascript,以便当我触发 onRowEditingStarted 事件时,它会转到第一个可编辑单元格,因为有时我的网格比屏幕大。
我可以获得 rowIndex,但无法获取列的集合来查看属性。我想保留 rowIndex,但获取第一个可编辑列并将焦点设置在那里。(现在,它是偶然选择的任何东西来触发事件。)
有人有一个例子我可以看一下吗?
我尝试查看这里生成的对象:
onRowEditingStarted: function(params) {
console.log("started row editing");
console.log(params);
}
Run Code Online (Sandbox Code Playgroud)
这给了我一个可以获得 rowIndex 和 columnApi 的事件。我希望这里的某个地方有一个集合来执行 for 循环,但我没有看到它。
你可以做类似的事情onRowEditingStarted
// scrolls to the first column, or first editable column. you can pass in the correct index
var firstEditCol = params.columnApi.getAllDisplayedColumns()[0];
/////
params.api.ensureColumnVisible(firstEditCol );
// sets focus into the first grid cell
params.api.setFocusedCell(params.rowIndex, firstEditCol);
Run Code Online (Sandbox Code Playgroud)
文档中的这个示例是一个很好的起点
| 归档时间: |
|
| 查看次数: |
13397 次 |
| 最近记录: |