Using checkbox to pass row ID to a CRUD button
Using checkbox to pass row ID to a CRUD button
shardage
Posts: 1Questions: 1Answers: 0
Hello,
I'm trying to use the checkbox to pass the ID to a button to delete that row, read more information for that row, or update that row. Here is the code for the row and buttons:
$(document).ready(function() {
$('#example').DataTable( {
"dom": 'lf<"toolbarDataTableP">trip',
"ajax": "/rest/get/listConfigProfiles",
"columns": [
{ "mData": "profileId",
"mRender": function(data, type, row)
{
return "<input type='checkbox' class='checkboxProfile' value=' "+data+" ' name = 'chkProfile' />";
}
},
{ "data": "profileName"},
{ "data": "profileID"}
]
} );
$("div.toolbarDataTableP").html('<button type="Submit" class="btn btn-default btn-sm" style="margin-left: 10px; margin-right: 10px;" data-toggle="modal" data-target="#createModal">Create</button>' +
'<button type="Submit" class="btn btn-default btn-sm" style="margin-legt: 10px; margin-right: 10px;" onclick="showProfileInformation()">More</button>' +
'<button type="Submit" class="btn btn-default btn-sm" style="margin-left: 10px; margin-right: 10px;" onclick="">Edit</button>' +
'<button type="Submit" class="btn btn-default btn-sm" style="margin-left: 10px; margin-right: 10px;" onclick="deleteProfile()">Delete</button>'
);
How do I pass the value for the row ID to the buttons? So that way the user can select a row using the checkbox and then click the button to read/edit/delete?
Thank you!
This discussion has been closed.