Requesting an isSelected() method in the API

Requesting an isSelected() method in the API

Loren MaxwellLoren Maxwell Posts: 322Questions: 75Answers: 9
edited January 26 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: 15,760Questions: 25Answers: 3,736
    edited January 27 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: 55,849Questions: 1Answers: 8,823 Site admin
    edited January 27 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: 322Questions: 75Answers: 9

    Thanks, Kevin (@kthorngren).

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

  • Loren MaxwellLoren Maxwell Posts: 322Questions: 75Answers: 9
    edited January 27

    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.