Show DataTable columns depending on select option header

Show DataTable columns depending on select option header

Sergio ProtechSergio Protech Posts: 22Questions: 4Answers: 0

HELLO EVERYONE. I WAS WONDERING IF ANYONE COULD HELP ME WITH SOMETHING.
I HAVE A MULTISELECT OPTION PLUGIN, IN WHICH ARE THE HEADERS OF THE TABLE. WHAT I WANT TO DO IS WHENEVER I CLICK A SELECT OPTION VALUE THE CERTAIN HEADER SHOULD APPEAR IN THE DATATABLE. THE DATATABLE IN THE BEGGININ SHOULD BE EMPTY. IF FOR EXAMPLE I I WANT TO SHOW THE SECOND HEADER, THEN IT WOULD APPEAR.

I KNOW THERE IS A SIMILAR CHOICE ONLINE IN WHICH THE DATATABLE IS NOT EMPTY, BUT INITIALIZED AND CLICKING ON SELECT IT TOGGLES THE CERTAIN HEADER. SO I WANT TO DO IT THE OTHER WAY IT.

This question has an accepted answers - jump to answer

Answers

  • Sergio ProtechSergio Protech Posts: 22Questions: 4Answers: 0


    THIS IS THE MULTISELECT PLUGIN. IF I CLICK A CERTAIN OPTION THE CURRENT CLICKED OPTION PASSES ON THE OTHER SIDE AND THE RESPECTIVE HEADER ON THE DATATABLE SHOULD APPEAR AND IF I CLICK ITS LABEL ALL HEADERS SHOULD APPEAR.

  • allanallan Posts: 63,488Questions: 1Answers: 10,467 Site admin
    Answer ✓

    No need to shout :)

    Sure - use row().remove() and row.add() to delete / add data as required. You can use table1.row({selected: true}).data() to get the data for the selected row and then add it to the other table for example.

    Allan

  • Sergio ProtechSergio Protech Posts: 22Questions: 4Answers: 0

    Thank u and i will keep you up to date if it worked

Sign In or Register to comment.