mirror of
https://github.com/scinote-eln/scinote-web.git
synced 2024-09-20 14:45:56 +08:00
Fix report table action buttons initialization [SCI-9737]
This commit is contained in:
parent
395a214175
commit
24309a4e03
|
@ -100,8 +100,18 @@
|
|||
}
|
||||
}
|
||||
|
||||
function initActionButtons() {
|
||||
initUpdatePDFReport();
|
||||
initGenerateDocxReport();
|
||||
initUpdateDocxReport();
|
||||
initEditReport();
|
||||
initSaveReportPDFToInventory();
|
||||
initDeleteReports();
|
||||
}
|
||||
|
||||
function updateButtons() {
|
||||
if (window.actionToolbarComponent) {
|
||||
window.actionToolbarComponent.setActionsLoadedCallback(initActionButtons);
|
||||
window.actionToolbarComponent.fetchActions({ report_ids: CHECKBOX_SELECTOR.selectedRows });
|
||||
$('.dataTables_scrollBody').css('padding-bottom', `${CHECKBOX_SELECTOR.selectedRows.length > 0 ? 68 : 0}px`);
|
||||
}
|
||||
|
@ -263,7 +273,7 @@
|
|||
}
|
||||
|
||||
function initUpdatePDFReport() {
|
||||
$(document).on('click', '#updatePdf', function(ev) {
|
||||
$('#updatePdf').on('click', function(ev) {
|
||||
ev.stopPropagation();
|
||||
ev.preventDefault();
|
||||
|
||||
|
@ -283,7 +293,7 @@
|
|||
}
|
||||
|
||||
function initGenerateDocxReport() {
|
||||
$(document).on('click', '#requestDocx', function(ev) {
|
||||
$('#requestDocx').on('click', function(ev) {
|
||||
ev.stopPropagation();
|
||||
ev.preventDefault();
|
||||
$(this).closest('.dropdown-menu').dropdown('toggle');
|
||||
|
@ -292,7 +302,7 @@
|
|||
}
|
||||
|
||||
function initUpdateDocxReport() {
|
||||
$(document).on('click', '#updateDocx', function(ev) {
|
||||
$('#updateDocx').on('click', function(ev) {
|
||||
ev.stopPropagation();
|
||||
ev.preventDefault();
|
||||
|
||||
|
@ -325,7 +335,7 @@
|
|||
}
|
||||
|
||||
function initSaveReportPDFToInventory() {
|
||||
$(document).on('click', '#savePdfToInventoryButton', function(ev) {
|
||||
$('#savePdfToInventoryButton').on('click', function(ev) {
|
||||
ev.preventDefault();
|
||||
ev.stopPropagation();
|
||||
|
||||
|
@ -347,7 +357,7 @@
|
|||
}
|
||||
|
||||
function initDeleteReports() {
|
||||
$(document).on('click', '#delete-reports-btn', function() {
|
||||
$('#delete-reports-btn').on('click', function() {
|
||||
if (CHECKBOX_SELECTOR.selectedRows.length > 0) {
|
||||
$('#report-ids').attr('value', '[' + CHECKBOX_SELECTOR.selectedRows + ']');
|
||||
$('#delete-reports-modal').modal('show');
|
||||
|
@ -376,10 +386,4 @@
|
|||
$('#show_report_preview').click();
|
||||
|
||||
initDatatable();
|
||||
initUpdatePDFReport();
|
||||
initGenerateDocxReport();
|
||||
initUpdateDocxReport();
|
||||
initEditReport();
|
||||
initSaveReportPDFToInventory();
|
||||
initDeleteReports();
|
||||
}());
|
||||
|
|
|
@ -88,6 +88,7 @@
|
|||
multiple: false,
|
||||
params: {},
|
||||
reloadCallback: null,
|
||||
actionsLoadedCallback: null,
|
||||
loaded: false,
|
||||
loading: false,
|
||||
width: 0,
|
||||
|
@ -107,6 +108,7 @@
|
|||
this.actions = data.actions;
|
||||
this.loading = false;
|
||||
this.setButtonOverflow();
|
||||
if (this.actionsLoadedCallback) this.$nextTick(this.actionsLoadedCallback);
|
||||
});
|
||||
}, 10);
|
||||
},
|
||||
|
@ -161,6 +163,9 @@
|
|||
setReloadCallback(func) {
|
||||
this.reloadCallback = func;
|
||||
},
|
||||
setActionsLoadedCallback(func) {
|
||||
this.actionsLoadedCallback = func;
|
||||
},
|
||||
doAction(action, event) {
|
||||
switch(action.type) {
|
||||
case 'legacy':
|
||||
|
|
Loading…
Reference in a new issue