How to use Select plugin and KeyTable plugin together?

How to use Select plugin and KeyTable plugin together?

ffradegradaffradegrada Posts: 10Questions: 2Answers: 0

Hey, first of all sorry about mi english.

I am trying to use both of these plugins together. What I want is to navigate the table (KeyTable plugin) but only up & down, and making a "complete row" selection as if I clicked one (Select plugin).

Is there something done about this or should I make custom logic?

Thanks!

Answers

  • allanallan Posts: 61,439Questions: 1Answers: 10,053 Site admin

    You can limit what keys KeyTable will listen for using the keys.keys option. Just set it to be an array of 38 and 40.

    and making a "complete row" selection as if I clicked one (Select plugin).

    What action do you want to use to select the row?

    Allan

  • ffradegradaffradegrada Posts: 10Questions: 2Answers: 0

    Hi! So limiting the keys of KeyTable it doesn't bother me. What I want to do is, to navigate up & down by row instead of by cell. So I need to select the entire row (by select I mean give it a 'selected' class to the tr) and hide the cell 'outline' style property.

    I could achieve this by playing with some listeners, but maybe there was a simplier choice to make.

    Do you understand me? (my english is so poor)

  • allanallan Posts: 61,439Questions: 1Answers: 10,053 Site admin

    What I want to do is, to navigate up & down by row instead of by cell.

    That is not a feature of KeyTable at this time I'm afraid. If that is something you need you would need your own key event listener and use row().select() to select the row.

    Allan

  • ffradegradaffradegrada Posts: 10Questions: 2Answers: 0

    So here I made a jsfiddle to see what I have made to satisfy what I need. Maybe it's useful for you, or maybe you can give me some advice on the using of row(), index(), etc..

    Here is the link: https://jsfiddle.net/q81xn073/

    Thanks!!

  • allanallan Posts: 61,439Questions: 1Answers: 10,053 Site admin
    edited February 2016

    I'm afraid I don't quite understand the issue. The example you linked to has the selected row moving up and down with arrow key presses. If you want the data from the selected row, use the select event to know when a row is selected.

    Could you clarify what the problem is please?

    Allan

  • ffradegradaffradegrada Posts: 10Questions: 2Answers: 0

    So, does the select plugin have the key navigation feature itself?

  • allanallan Posts: 61,439Questions: 1Answers: 10,053 Site admin

    No. Your example listens for key-focus which is what is doing the key handling there.

    Allan

  • ffradegradaffradegrada Posts: 10Questions: 2Answers: 0

    Right! So that was my original question. My jsfiddle example is working 100% but I see that it is a little confusing.. So I was wondering if there was any config to avoid what I've done..

    Nevermind, it's ok, you can close the question! I found very useful that you added the serverSide functionality to the KeyTable as when I started my project a few months ago it wasn't!!

    Thanks!!

  • allanallan Posts: 61,439Questions: 1Answers: 10,053 Site admin

    Basically no - you need to use the API and events to replicate the behaviour as you have. There is no option for that built in :-)

    Allan

This discussion has been closed.