Add a select all checkbox at table header dynamically
* implements wishlist at bug 959017 Change-Id: I22a1fc3007dcf69e5f3f0d9eac48adbe62ad8035
This commit is contained in:
parent
f2c4e80fce
commit
b3c70356b4
@ -145,7 +145,7 @@ var Horizon = function() {
|
|||||||
|
|
||||||
$("form :checkbox").on("click", function (evt) {
|
$("form :checkbox").on("click", function (evt) {
|
||||||
var $form = $(this).closest("form");
|
var $form = $(this).closest("form");
|
||||||
var any_checked = $form.find(":checkbox").is(":checked");
|
var any_checked = $form.find("tbody :checkbox").is(":checked");
|
||||||
|
|
||||||
// Enable the button if any checkbox is checked,
|
// Enable the button if any checkbox is checked,
|
||||||
// Disable if all checkbox is cleared
|
// Disable if all checkbox is cleared
|
||||||
|
@ -26,5 +26,15 @@ horizon.addInitFunction(function() {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// Add a select all checkbox at table header
|
||||||
|
$('table thead .multi_select_column').append('<input type="checkbox">');
|
||||||
|
$('table thead .multi_select_column :checkbox').click(function(evt) {
|
||||||
|
var $this = $(this),
|
||||||
|
$table = $this.closest('table'),
|
||||||
|
is_checked = $this.prop('checked'),
|
||||||
|
checkboxes = $table.find('tbody :checkbox');
|
||||||
|
checkboxes.prop('checked', is_checked);
|
||||||
|
});
|
||||||
|
|
||||||
horizon.datatables.update();
|
horizon.datatables.update();
|
||||||
});
|
});
|
||||||
|
@ -738,7 +738,7 @@ th.multi_select_column, td.multi_select_column {
|
|||||||
width: 25px;
|
width: 25px;
|
||||||
}
|
}
|
||||||
|
|
||||||
td.multi_select_column {
|
th.multi_select_column, td.multi_select_column {
|
||||||
text-align: center;
|
text-align: center;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user