Add select/deselect button to column visible

Add select/deselect button to column visible

KateBKateB Posts: 3Questions: 1Answers: 0

Hi I am trying to add a 'Select / Deselect all' to the 'colvis' button but I have some strange behavior - click on the first item triggers Select / Deselect another - when I click on the second one nothing happend with 'Select / Deselect all' button.
I've created simple example for this http://live.datatables.net/tahozuna/4/edit
steps:
1. Click on Column Visibility button
2. Click on first Item => 'Select / Deselect all' - will be changed its state

This question has an accepted answers - jump to answer

Answers

  • colincolin Posts: 15,166Questions: 1Answers: 2,588

    Thanks for the test case. I just tried it, with those steps, and it seems to be behaving as expected for me. Can you expand those steps please, saying what's happening at each one, and what you would expect to happen instead,

    Colin

  • KateBKateB Posts: 3Questions: 1Answers: 0

    Hi, Colin! Thank you for answer.
    I've just corrected the example site: http://live.datatables.net/tahozuna/8/edit
    So, my steps:
    1. Click on Column Visibility button
    2. Click on first Item => 'Select / Deselect all' - will be changed its state
    3. Click on first Item => all buttons have the same state
    4. Click on the second Item => 'Select / Deselect all' - the state won't be changed
    5. Click on the second Item => all buttons have the same state
    6. Click on the third Item => 'Select / Deselect all' - the state won't be changed
    7. Click on the third Item => all buttons have the same state

    It will be perfect to me not to change the state of Select / Deselect all button when I click on the first button, if it possible

    Thank

  • allanallan Posts: 61,864Questions: 1Answers: 10,136 Site admin
    Answer ✓

    Using the columnToggle button probably isn't ever going to give you a suitable state, since it only considers a single column.

    You probably want a custom function - here is an example: http://live.datatables.net/tahozuna/12/edit .

    Allan

  • KateBKateB Posts: 3Questions: 1Answers: 0

    @allan, thank you a lot, you made my day!

This discussion has been closed.