Skip to content

Replies

0
Steve Hildebrand
Steve Hildebrand answered on Apr 13, 2020 8:55 PM

Worked perfectly.  Thanks for all of your help!

0
Steve Hildebrand
Steve Hildebrand answered on Apr 10, 2020 5:45 PM

Hi Martin, thanks for the sample.  It worked perfectly.  I did make a few changes to capture arrow right/left.  I don't suppose there's a way to capture tab left?

customKeydown(e) {
if (
e.targetType === "dataCell" &&
(e.event.key.toLowerCase() === "tab" ||
e.event.key.toLowerCase() === "arrowright" ||
e.event.key.toLowerCase() === "arrowleft")
) {
e.event.preventDefault();
e.cancel = true;

let cellPosition: ICellPosition = null;

if (
e.event.key.toLowerCase() === "arrowright" ||
e.event.key.toLowerCase() === "tab"
) {
cellPosition = this.grid.getNextCell(
e.target.rowIndex,
e.target.visibleColumnIndex,
(col) => col.editable
);
}

if (e.event.key.toLowerCase() === "arrowleft") {
cellPosition = this.grid.getPreviousCell(
e.target.rowIndex,
e.target.visibleColumnIndex,
(col) => col.editable
);
}

this.grid.navigateTo(
cellPosition.rowIndex,
cellPosition.visibleColumnIndex,
(obj) => obj.target.nativeElement.focus()
);
}
}