[英]Skip focus on some hide fields on AG Grid
I am using Angular and AG-Grid and I have a table bellow我正在使用 Angular 和 AG-Grid,下面有一张表格
When the user hovers over a row, 2 hidden buttons will show up当用户将鼠标悬停在一行上时,将显示 2 个隐藏按钮
Those buttons actually belong to the 2 hidden headers这些按钮实际上属于 2 个隐藏的标题
The thing is when I use the tab to navigate through the table, I want to skip those hidden headers fields, for example, I am on Description
when I continue to press Tab
what I expect is it will skip 2 hidden headers and jump on to the hash value问题是当我使用选项卡在表格中导航时,我想跳过那些隐藏的标题字段,例如,当我继续按
Tab
时我在Description
上,我期望它会跳过 2 个隐藏的标题并跳转到hash 值
I did a research but cannot find the solution for this.我做了一项研究,但找不到解决方案。 Thank you for your help.
谢谢您的帮助。
You can make use of tabToNextHeader
property您可以使用
tabToNextHeader
属性
In template add the attribute and callback function as below:在模板中添加属性和回调 function 如下:
[tabToNextHeader]="nextHeader"
In component file define the method.在组件文件中定义方法。 Here we are setting the focus to first column in the next row, by skipping the rest of the header columns.
在这里,我们通过跳过 header 列中的 rest 将焦点设置到下一行的第一列。 Note: This is a sample code, update accordingly.
注意:这是示例代码,请相应更新。
nextHeader(params: any) {
const previousHeader = params.previousHeaderPosition;
// Select the first column in the next row
let nextColumn = previousHeader.column.columnApi.getAllColumns()[0];
if(previousHeader.column.colId === 'description' && params.backwards === false) {
return {
headerRowIndex: -1, // return a non-header row
column: nextColumn,
};
}
// TODO: Add logic for reverse tab, make use of 'backwards' field in params
return params.nextHeaderPosition;
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.