Fixed #3888 - DataTable (Virtual Scroll): Cannot set properties of undefined (setting 'tabIndex')

pull/4402/head
Tuğçe Küçükoğlu 2023-09-06 14:40:05 +03:00
parent dee886dbf8
commit 46cf924d09
1 changed files with 3 additions and 2 deletions

View File

@ -722,7 +722,6 @@ export default {
}, },
onRowClick(e) { onRowClick(e) {
const event = e.originalEvent; const event = e.originalEvent;
const index = e.index;
const body = this.$refs.bodyRef && this.$refs.bodyRef.$el; const body = this.$refs.bodyRef && this.$refs.bodyRef.$el;
const focusedItem = DomHandler.findSingle(body, 'tr[data-p-selectable-row="true"][tabindex="0"]'); const focusedItem = DomHandler.findSingle(body, 'tr[data-p-selectable-row="true"][tabindex="0"]');
@ -803,8 +802,10 @@ export default {
this.rowTouched = false; this.rowTouched = false;
if (focusedItem) { if (focusedItem) {
const targetRow = e.originalEvent.target.closest('tr[data-p-selectable-row="true"]');
focusedItem.tabIndex = '-1'; focusedItem.tabIndex = '-1';
DomHandler.find(body, 'tr[data-p-selectable-row="true"]')[index].tabIndex = '0'; targetRow.tabIndex = '0';
} }
}, },
onRowDblClick(e) { onRowDblClick(e) {