微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

使用键盘上和下键浏览角度物料表单元格

如何解决使用键盘上和下键浏览角度物料表单元格

how to navigate table cells in mat-table using arrow(up & down) keys in keyboard.  I have tried using java script but I Could not find correct solution.Any help is appreciated.
  1. 文档上的主机侦听器:按下事件时调用函数 @零件({ 选择器:“ table-basic-example”, styleUrls:['table-basic-example.css'], templateUrl:“ table-basic-example.html”, 主持人:{ '(document:keydown)':'checkKeystroke($ event)' } })
2. Calling function on key press event:

  this.start =document.getElementById('start');
   if (e.keyCode == '40') {
    // down arrow
    let idx = this.start.cellIndex;
 //  get the next row cell 
    let nextrow = this.start.parentElement.nextElementSibling;
    if (nextrow != null) {
      let sibling = nextrow.cells[idx];
      this.navigatetoCell(sibling);

    }
  } 
}

below is the link what I tried so far https://stackblitz.com/edit/angular-mwdvbw?file=src%2Fapp%2Ftable-basic-example.ts

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。