I use checkbox inside data table cell and after one or more checkbox checked , i show the Add button to make changes . but my problem is i cant take values from cells after checking checkboxes . if i can take values of checked checkboxes then i can send them to data table make necessary changes
<td class="denetleme">
<div class="vs-checkbox-con vs-checkbox-success">
<input class="selectAll_1 selectinput" type="checkbox" value="true" >
<span class="vs-checkbox">
<span class="vs-checkbox--check">
<i class="vs-icon feather icon-check"></i>
</span>
</span>
</div>
</td>
if one or more checkbox checked in a line, then take these checkboxes and columns id also
You can get entire data of cell with .selectinput
$('#mytable .selectinput').each(function() {
alert($(this).html());
});
$('#saveBtn').click(function () {
var dataArr = [];
$.each($("#genelTablo tr.selected td.checkElement input.selectinput"), function () { //get each tr which has selected class
var getColumnOfTd = $(this).closest("td")
console.log("column", table.cell(getColumnOfTd).index().column, table.cell(getColumnOfTd).index().row)
dataArr.push({
columnName: $(this).closest("tr").find("td:first-child").text(),
columnId: table.cell(getColumnOfTd).index().column,
rowId: table.cell(getColumnOfTd).index().row,
inputValue: $(this).val()
})
//dataArr.push($(this).find('td.checkElement input').val()); //find its first td and push the value
//dataArr.push($(this).find('td:first').text()); You can use this too
});
console.log("here",dataArr);
});
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.