Requesting an isSelected() method in the API

Requesting an isSelected() method in the API

Loren MaxwellLoren Maxwell Posts: 387Questions: 94Answers: 10
edited January 2022 in Feature requests

I'd like to make a feature request for an isSelected() method in the API, such as:

cell().isSelected()
column().isSelected()
row().isSelected()

It seems at the moment jQuery's hasClass is the only way to determine is the row is selected:
https://www.datatables.net/forums/discussion/comment/148900/

This question has accepted answers - jump to:

Answers

  • kthorngrenkthorngren Posts: 20,425Questions: 26Answers: 4,794
    edited January 2022 Answer ✓

    Allan or Colin can comment on when or if there will be an API for this. It would be handy. In the meantime you can create your own API plugin. Something like this:
    http://live.datatables.net/fesufubu/1/edit

    Click the button you will see false. Select Ashton Cox row and click the button again.

    Kevin

  • allanallan Posts: 61,972Questions: 1Answers: 10,160 Site admin
    edited January 2022 Answer ✓
    table.row('#selector', {selected: true}).any()
    

    would also do it.

    However, I agree - this is a utility method that would round off the API nicely. I've committed it in here and it will be in the next release of Scroller.

    Allan

  • Loren MaxwellLoren Maxwell Posts: 387Questions: 94Answers: 10

    Thanks, Kevin (@kthorngren).

    I still hope @allan and company add this to the API, but this works great!

  • Loren MaxwellLoren Maxwell Posts: 387Questions: 94Answers: 10
    edited January 2022

    Thanks, @allan!

    And just a minor note for clarification for future readers, I think you meant in the next release of Select :-)

Sign In or Register to comment.