Reputation: 113
I need to add the check box and button in jquery data table all rows. check box need to add the first column and button need to add the final column. using mvc format. I try this below code . but its only display the button only. How can i add the check box in very first column
Upvotes: 1
Views: 2321
Reputation: 113
Using like this:
"aoColumnDefs": [{
"aTargets": [0],
"fnCreatedCell": function (nTd, sData, oData, iRow, iCol) {
if (iCol == 0) {
$('<input type=\"checkbox\" value="' + sData + '">');
}
}
},
{
"aTargets": [7],
"fnCreatedCell": function (nTd, sData, oData, iRow, iCol) {
if (iCol == 7) {
var b = $('<button>test</button>');
b.on('click', function () {
});
$(nTd).empty();
$(nTd).prepend(b);
}
}
}],
Upvotes: 1