Directions to create custom button to autofill a value into all rows in a specific column
Directions to create custom button to autofill a value into all rows in a specific column
YoDavish
Posts: 123Questions: 46Answers: 3
Can someone point in the direction on how to create a custom button that will automatically set a value of "1" to a specific column for every row in the table?
I tried to use this method to get me started but all it does is select the entire table only.
https://datatables.net/forums/discussion/53206/select-all-via-checkbox
This discussion has been closed.
Answers
One option is to use
cells().every()
to iterate all the cells of a particular column then usecell().data()
to update the cell. For example:http://live.datatables.net/picabidi/1/edit
Kevin
@kthorngren so it shows in the datatables as updated for my column, however, when I look at the actual database table it's not actually saving to it. When I refresh the page, the columns are set to no. If I manually, select the cell to yes it updates into the database table correctly. Here is the entire code below:
Kevin's answer is correct, if you're not using Editor - you forgot to mention that bit!
With Editor, you would need to use
edit()
to modify each row, or usemultiSet()
to edit them all in a single operation (though not sure how it would cope if too many were set).Colin
You didn't mention you were using Editor and that you wanted the Database to be updated. You can use the
edit()
API. Check the docs for using the row selector and examples,.Kevin