Skip to content

Data Grid cell tabindex

New Discussion
Steve Hildebrand
Steve Hildebrand asked on Apr 14, 2020 9:46 AM

Is there a way to skip over cells that are not editable?  I was thinking tabindex might achieve this, but haven’t been able to get it to work.

I’ve tried the following, but when I look in inspector, it still has a tabindex of 0.

<igx-column field=”invoiceDate” header=”Invoice Date” dataType=”date”>
<ng-template igxCell let-cell=”cell” let-value>
<span tabIndex=”-1″></span>{{ value | date: “MM/dd/yy” }}</span>
</ng-template>
</igx-column>
Sign In to post a reply

Replies

  • 0
    Martin Asenov
    Martin Asenov answered on Apr 10, 2020 2:19 PM

    Hello,

    Thank you for posting in our community.

    I have created and attached a small sample demonstrating how to skip cells that are not editable using igxGrid's onGridKeydown event. Please test this sample on your side and let me know whether it resolves your issue.

    Additionally, this thread in our GitHub repository could be of help to you.

    4341.Sample.zip

    • 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()
      );
      }
      }
      • 0
        Martin Asenov
        Martin Asenov answered on Apr 13, 2020 12:54 PM

        Hi Steve,

        Indeed there is. You can check if the shift key is pressed during the keyboard event together with the tab key:

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

        Please let me know if you need any further assistance with this matter.

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

        Worked perfectly.  Thanks for all of your help!

      • 0
        Martin Asenov
        Martin Asenov answered on Apr 14, 2020 9:46 AM

        I am glad that you find my suggestion helpful.

        Thank you for using Infragistics components.

  • You must be logged in to reply to this topic.
Discussion created by
Favorites
Replies
Created On
Last Post
Discussion created by
Steve Hildebrand
Favorites
0
Replies
5
Created On
Apr 14, 2020
Last Post
5 years, 10 months ago

Suggested Discussions

Tags

No tags

Created by

Created on

Apr 14, 2020 9:46 AM

Last activity on

Feb 19, 2026 9:21 AM