Skip to content

Commit 5b16222

Browse files
select or deselect all #46
1 parent 0e2c6e0 commit 5b16222

1 file changed

Lines changed: 13 additions & 1 deletion

File tree

Views/LUIComponentCalculation/ComponentCalculation.cshtml

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
<table id="compontentData">
1919
<thead>
2020
<tr>
21-
<th></th>
21+
<th class="select-checkbox"><input id="checkBox" type="checkbox"></th>
2222
@for (int c = 0; c < Model.Data.Columns.Count; c++)
2323
{
2424
<th>
@@ -67,13 +67,25 @@
6767
});
6868
});
6969
70+
//select or deselect all
71+
$('#checkBox').on('click', function () {
72+
if ($('#checkBox').is(':checked')) {
73+
tbl.rows().select();
74+
}
75+
else {
76+
tbl.rows().deselect();
77+
}
78+
});
79+
80+
7081
function upload() {
7182
var selectedIds = [];
7283
$.each(tbl.rows('.selected').nodes(), function (i, item) {
7384
selectedIds.push(item.id);
7485
//var data = tbl.row(this).data();
7586
});
7687
88+
7789
console.log(selectedIds);
7890
$.post('@Url.Action("UploadSelectedRows", "LUIComponentCalculation", new RouteValueDictionary { { "area", "LUI" } })', { rowIds: selectedIds }, function (data) {
7991
document.getElementById("error").textContent += data;

0 commit comments

Comments
 (0)