mirror of
https://github.com/snipe/snipe-it.git
synced 2025-03-05 20:52:15 -08:00
Updated JS to better handle input IDs
Signed-off-by: snipe <snipe@snipe.net>
This commit is contained in:
parent
4eed2baa31
commit
515b14a001
|
@ -116,32 +116,30 @@
|
|||
// These methods dynamically add/remove hidden input values in the bulk actions form
|
||||
$('.snipe-table').on('check.bs.table .btSelectItem', function (row, $element) {
|
||||
var buttonName = $(this).data('bulk-button-id');
|
||||
var formName = $(this).data('bulk-form-id');
|
||||
var tableId = $(this).data('id-table');
|
||||
|
||||
$(buttonName).removeAttr('disabled');
|
||||
$(formName).append('<input id="' + tableId + '_checkbox_' + $element.id + '" type="hidden" name="ids[]" value="' + $element.id + '">');
|
||||
$(buttonName).after('<input id="' + tableId + '_checkbox_' + $element.id + '" type="hidden" name="ids[]" value="' + $element.id + '">');
|
||||
});
|
||||
|
||||
$('.snipe-table').on('uncheck.bs.table .btSelectItem', function (row, $element) {
|
||||
var tableId = $(this).data('id-table');
|
||||
$( "#" + tableId + "_checkbox_" + $element.id).remove();
|
||||
});
|
||||
|
||||
|
||||
$('.snipe-table').on('check-all.bs.table', function (event, rowsAfter) {
|
||||
|
||||
var buttonName = $(this).data('bulk-button-id');
|
||||
$(buttonName).removeAttr('disabled');
|
||||
var formName = $(this).data('bulk-form-id');
|
||||
var tableId = $(this).data('id-table');
|
||||
|
||||
for (var i in rowsAfter) {
|
||||
$(formName).append('<input id="' + tableId + '_checkbox_' + rowsAfter[i].id + '" type="hidden" name="ids[]" value="' + rowsAfter[i].id + '">');
|
||||
$(buttonName).after('<input id="' + tableId + '_checkbox_' + rowsAfter[i].id + '" type="hidden" name="ids[]" value="' + rowsAfter[i].id + '">');
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
$('.snipe-table').on('uncheck.bs.table .btSelectItem', function (row, $element) {
|
||||
var tableId = $(this).data('id-table');
|
||||
$( "#" + tableId + "_checkbox_" + $element.id).remove();
|
||||
});
|
||||
|
||||
|
||||
// Handle whether or not the edit button should be disabled
|
||||
$('.snipe-table').on('uncheck.bs.table', function () {
|
||||
|
||||
|
|
Loading…
Reference in a new issue