Disable Scroll To Next Row | Keytable stop scroll to next line | Stop scrolling to next row

Disable Scroll To Next Row | Keytable stop scroll to next line | Stop scrolling to next row

aungkoheinaungkohein Posts: 38Questions: 5Answers: 0

Hi!

I'm using Keytable for excel-like navigation. My user wants to stop scrolling to next row once he reached the end of each row.

Currently, it is having continuous scroll if you press the right arrow key.

How to disable that?

Thanks for the help!

Replies

  • colincolin Posts: 15,240Questions: 1Answers: 2,599

    Hi @aungkohein ,

    That's not possible I'm afraid, not without modifying the KeyTable JS yourself (one perk of open source s/w). You can create new behaviour for keys, see this thread here, but if the key is recognised and already handled by KeyTable, it won't trigger the event.

    Cheers,

    Colin

  • allanallan Posts: 63,471Questions: 1Answers: 10,467 Site admin

    This is the line of code to modify. Just make that if branch a noop and it will hold its current position at the end of the row.

    Allan

  • aungkoheinaungkohein Posts: 38Questions: 5Answers: 0

    Hi @allan

    I'm using dataTables.keyTable.min.js. Can you point where I can change it?

    There is no row++ in min.js..

  • colincolin Posts: 15,240Questions: 1Answers: 2,599

    Hi @aungkohein ,

    You wouldn't want to edit the minified version, just edit the version Allan linked to!

    Cheers,

    Colin

  • aungkoheinaungkohein Posts: 38Questions: 5Answers: 0
    edited January 2019

    Hi @colin

    Thanks for the help! But I can't get it right. I have tried removing row++ and changed to row-- etc. eventually, I removed the whole section. Doesn't work.

    What I would like is to stop scrolling to next line at the end of each line (using right arrow keys or tab key)

            if ( direction === 'right' ) {
    //          if ( currCol >= columns.length - 1 ) {
    //              row++;
    //              column = columns[0];
    //          }
    //          else {
    //              column = columns[ currCol+1 ];
    //          }
                row--;
            }
            else if ( direction === 'left' ) {
    //          if ( currCol === 0 ) {
    //              row--;
    //              column = columns[ columns.length - 1 ];
    //          }
    //          else {
    //              column = columns[ currCol-1 ];
    //          }
                row++;
            }
            else if ( direction === 'up' ) {
                row--;
            }
            else if ( direction === 'down' ) {
                row++;
            }
    
  • colincolin Posts: 15,240Questions: 1Answers: 2,599

    As Allan said in his reply, just comment out lines 911 and 912.

This discussion has been closed.