We are pleased to introduce jQuery DataTables Checkboxes extension that makes it easy to add a checkbox columns to a table.
Example
Example below shows a data table using client-side processing mode where data is received from the server using Ajax.
Please visit dedicated jQuery DataTables Checkboxes page to download the code, view examples and documentation.
Hi Michel, why when i get selected column always giving
thanks
There could be multiple reasons. Most obvious would be that you need to include files jQuery DataTables Checkboxes JS/CSS after jQuery DataTables JS/CSS files. If that doesn’t resolve your issue, please share an example that demonstrates the problem. Thanks!
This, like many pages / examples of a datatable with checkboxes driven with this tooling, announce “x rows selected” in the data table footer. Mine is not doing that for some reason and as I’ve browsed several examples worth of code trying to find “the magic”, I have been unsuccessful. So the question is either (1) Why is this syntax not automatically showing up in my DataTables footer or (2) How can I get this syntax to appear?
If you can share some examples publicly or privately (through the contact form), I will be able to give you more information. In general in order to see the “X rows selected”, the following conditions have to be met:
checkboxes.selectRow
option, see this example.Michael,
Ah HA! That was EXACTLY what I needed. Well sort of. I had originally, using demo examples, configured the “selectRow” option so that a checked box styled the row but found, since I use table-striping in my DataTable, I found the adjusted color (the tooling automatically references the “.selected” class) leaves things kind of hideous as you cursor over things…which I did not want.
So now, while you have solved the problem by explaining that the “x rows selected” is contingent on “selectRow” to do its work, I’m left back were I was. I basically want to change the CSS for “.selected” so it does not change the color…leaving it EXACTLY how it is so there is no VISUAL indication, but obviously still enabling the reliance on the class being present as the user clicks/unclicks the checkbox.
I’m ok at CSS, but I don’t see a way to override the class so that is basically does a background-color of “leave it alone”.
If you have any ideas there, would love the help…meanwhile, I’m removing the table striping which pretty much resolves the issue. I find that row highlight (plugins) mucks that all up visually pretty badly so I’ll likely have to turn that off too.
However, you definitely explained away the problem and for that, I’m grateful.
Mike
Hi Michael,
When we are using datatable serverside=true, function datatable.columns().checkboxes.selected() returns selected rows with only one column values.
Can we get all column values from selected rows (example below)?
https://drive.google.com/file/d/1_AhXgt7BvN3yxuwkK645iWInM-p24g4N/view?usp=sharing
Regards,
Nikola
Hello, I used datatables fetching data to my database. I want to get the values of the checked rows and save it to the another table.
Hello, I recently came across this plugin which is pretty cool, just have a few question Here is a test case i came up with: What i noticed when i introduced the plugin is that:
(1) The hard coded input values i set for each check box is overridden, i don’t want this. is there a way around this ?
(2) The styling i originally use in the hard coded HTML is also overridden, I don’t want this, I want the original formatting to remain.
(3) I want to use my own styling for the “select all” check box, is that possible ?
So all this boils down to is having to add just a select all check box with custom styling, and not changing anything in the html.
hello Michael, im trying to send the data to a controller, but always es empty, but in console works, can you helpme please, whats wrog with my code.
Hi Michael,
I implemented a RoR app where I successfully used datatables. One column has checkboxes, which worked fine. Now I wanted to have a “check all” on the filtered result of the table. After adding the part for dt-checkboxes this was working.
Unfortunately the form is no longer posting the checkbox values to the server. Inspecting the checkbox I found no id, or name, or value attribute.
What am I doing wrong?
Thanks