Edit Show / hide columns dynamically In API

Edit Show / hide columns dynamically In API

menssouri83menssouri83 Posts: 5Questions: 1Answers: 0
edited October 2015 in Free community support

Hello ,
in the Show / hide columns dynamically page :
http://datatables.net/examples/api/show_hide.html
http://s23.postimg.org/gtuit6orv/image.png

We want to change the text lien select columns to checkbox option like in this exemple
http://s28.postimg.org/toyqtzq6l/image.png
When the checkbox are selected and checked the comumns are visible if the checkbox are not selected and are unchecked the columns are unvisible
Can same one help me please !

Answers

  • jLinuxjLinux Posts: 981Questions: 73Answers: 75
    edited October 2015

    So just create the checkboxes, either hardcode them or use the columns() to get the columns, then JS/jQuery to draw them up.

    Give the checkboxes an attribute like data-column with either the column index #, or the column name (set by columns.name). Then with jQuery, create a .click() event watcher for the checkboxes, to check if it was just checked or unchecked, then use the column().visible() functionality to hide/show the column.

    Another option, would be to use the Column Visibility Button, which is what I prefer.

    Did you just need help on how to do it? Or were you looking for someone to basically do it for you?

  • menssouri83menssouri83 Posts: 5Questions: 1Answers: 0

    I'm not an expert in code , can you give me an exemple or if you can do it to me it well be very great .

    Toggle column:
    </a> - <a class="toggle-vis" data-column="0">Name</a> - <a class="toggle-vis" data-column="1">Network</a> - <a class="toggle-vis" data-column="2">Advertiser</a> - <a class="toggle-vis" data-column="3">Status</a> - <a class="toggle-vis" data-column=
    "4">Preview</a>

  • jLinuxjLinux Posts: 981Questions: 73Answers: 75

    I usually find if I just do the code for someone, they usually come back for a glass of milk, apologies

    If you need someone to do it for you, and since its a small enough task, maybe you can purchase some support from @allan, and he can knock it out. But thats up to him, obviously.

  • menssouri83menssouri83 Posts: 5Questions: 1Answers: 0

    many thanks

  • menssouri83menssouri83 Posts: 5Questions: 1Answers: 0

    Any one can help me to do it without purchase any payed support !

  • jLinuxjLinux Posts: 981Questions: 73Answers: 75
    edited October 2015

    If you arent a web developer, and dont have any desire to learn how to code, then youre going to have to hire a developer sooner or later..

    If you do want tl learn js, this task is simple enough with just a few lines of jquery and the datatables api

    Alternatively, I would suggest just using the columnsVisibility or columnsToggle or colvis

  • allanallan Posts: 63,075Questions: 1Answers: 10,384 Site admin

    Yes, this forum will not actively develop new software specific to your project for you. We can help with specific DataTables questions if you link to a page showing what you have got already, but creating individual projects is not a service I offer.

    Allan

This discussion has been closed.