Clicking on column toggles boolean value
Clicking on column toggles boolean value

Hello
I have a table currently with 5 columns one of which is a boolean value,
I was trying to implement a solution where the user clicks on the column
and that row column 5 would toggle from True to False or False to True
I could find a way to get the data but not update or set the data and have the table refresh with the correct data
eg.
var data = table.row('.selected').data();
alert(data[5]);
I found that if i set the data value manually with say table.row('.selected').data()[0][5] = "False"
then run table.draw() it does not update
What's the best way to do this?
Thanks
Answers
The docs for
row().data()
show that you need to pass the updated row data as a parameter. You will need something like this:Kevin
Thank you it worked perfectly
I have added a button where I can select multiple rows and click on the button,
Hoping that it would set each of the rows to say "False"
I tried var row = table.rows('.selected').data() using var data = row[count]
Seems to work fine for getting the data via alert() but setting the data it doesn't
Any ideas?
To loop through multiple rows use
rows().every()
. Inside the loop you can get and set the data for each row as above.Kevin