How to send hidden value by row
How to send hidden value by row

"I want to be able to select any row, so please add a checkbox and include the ID in a hidden field. I tried using <th data-visible="false"></th>, but it's not working. How can I achieve this?"
Replies
Are you asking how to hide a column? Use
columns.visible
and set itfalse
.Kevin
Thanks.
But when I use visible: false, I'm not able to get the value.
This is the current HTML element when I use:
columnDefs: [
{ targets: 1, visible: false }
]
<td class="no-wrap"></td>
Previously (when I was using DataTables version 1.6.0), the HTML looked like this:
<td class="hidden no-wrap">
<input type="checkbox" name="asset_id" id="asset_9329" value="9329" class="checkbox">
</td>
If you’d like, I can help you troubleshoot why the checkbox is missing when using visible: false. Let me know!
How are you trying to get the value?
They won't be in the document so jQuery and Javascript methods won't find them.
Use Datatables API's like
cell().data()
orcell().node()
to access the hidden cells.For more specific help please provide a simple test case showing what you have.
https://datatables.net/manual/tech-notes/10#How-to-provide-a-test-case
Maybe start with this:
https://live.datatables.net/
Kevin
Maybe this example of delegated events will help.
Kevin
Thanks for the suggestion!
Can I get the checked value of the selected row?
can i add hidden checkbox in row ??
Sure. Add a class or style to it and set it to
display: none
.Selected how - via Select, or via one of your own methods? For Select, use the API.
Allan