How to display toggle in dashboard once the hidden column is enable in colvis ?
How to display toggle in dashboard once the hidden column is enable in colvis ?

I have implemented Datatables with custom button of colvis.
If it is selected then columns get visible properly. But in this, there are couple of columns, in which i have toggle button UI is used. So it is not displaying that instead shows a checkbox.![]
(https://datatables.net/forums/uploads/editor/a4/pptzz4vpca2c.png "")
How can i resolve it. ?
This question has an accepted answers - jump to answer
This discussion has been closed.
Answers
You will want to use
rowCallback
to apply the toggle to the checkbox. Here is an example with Bootstrap toggle:http://live.datatables.net/noyivopo/1/edit
If this doesn't help then please post a link to your page or a test case replicating the issue so we can help diagnose.
https://datatables.net/manual/tech-notes/10#How-to-provide-a-test-case
Kevin
Hi Kevin.
Firstly, Thank you for your reply. Much Appreciated.
I have updated the in the same link so that will be much easier to understand.
Below is my code Scenario.
http://live.datatables.net/noyivopo/120/edit
So there is column visibility where default, Checkbox column is hidden.
When i show that column through colvis, ON OFF toggle doesn't appear. Instead it appears as a checkbox.
First problem is you removed the bootstraptoggle.js. Next is for column visibility you can use the
column-visibility
event to handle the checkboxes. Updated your example:http://live.datatables.net/roguhufi/1/edit
Kevin
Hi Kevin.
This works out for me on page load. But i have values coming from server side through ajax requests.
So while using server side, the bootstraptoggle.js needs to be called again once checkbox gets visibility
Do you have it in the
rowCallback
like the example?Kevin
Hi Kevin.
Thanks alot for your help.
In my workflow,
**drawCallback ** and
$('#example').on( 'column-visibility.dt', function ( e, settings, column, state ) {
// code
});
Worked for me.
**rowCallback ** has repeated the same multiple times as number of rows. So with drawCallback things work for me. But your hint for rowCallback has helped me to get it solved.
Thanks a lot for your support.