mirror of
https://github.com/devcode-it/openstamanager.git
synced 2025-02-03 01:08:08 +01:00
Inizializzazione datatables nei plugin solo quando vengono aperti
This commit is contained in:
parent
9b583a7259
commit
cb94c91a86
@ -74,7 +74,13 @@ $(document).ready(function () {
|
||||
numeral.defaultFormat('0,0.' + ('0').repeat(globals.cifre_decimali));
|
||||
|
||||
// Richiamo alla generazione di Datatables
|
||||
start_datatables();
|
||||
start_datatables( $('.main-records') );
|
||||
|
||||
// Avvio datatables dei plugin solo al primo click
|
||||
$('.nav-tabs li').not('.clicked').on('click', function(){
|
||||
$(this).addClass('clicked');
|
||||
start_datatables( $(".tab-pane.active .main-records-plugins") );
|
||||
});
|
||||
|
||||
// Calendario principale
|
||||
start_complete_calendar("#daterange", function (start, end) {
|
||||
|
@ -34,10 +34,10 @@ function start_local_datatables() {
|
||||
}
|
||||
|
||||
// Datatable
|
||||
function start_datatables() {
|
||||
function start_datatables( $elements ) {
|
||||
start_local_datatables();
|
||||
|
||||
$('.main-records').each(function () {
|
||||
$elements.each(function () {
|
||||
const $this = $(this);
|
||||
|
||||
// Controlla che la tabella non sia già inizializzata
|
||||
@ -451,7 +451,7 @@ function getTable(selector) {
|
||||
if (table.hasClass('datatables')) {
|
||||
start_local_datatables();
|
||||
} else {
|
||||
start_datatables();
|
||||
start_datatables( $('.main-records') );
|
||||
}
|
||||
},
|
||||
datatable: table.DataTable(),
|
||||
|
@ -99,7 +99,7 @@ if (!empty($type) && $type != 'menu' && $type != 'custom') {
|
||||
|
||||
$table_id = 'main_'.rand(0, 99);
|
||||
echo '
|
||||
<table data-idmodule="'.$id_module.'" data-idplugin="'.$id_plugin.'" data-idparent="'.$id_record.'" data-selected="'.implode(';', $selezione).'" id="'.$table_id.'" width="100%" class="main-records table table-condensed table-bordered">
|
||||
<table data-idmodule="'.$id_module.'" data-idplugin="'.$id_plugin.'" data-idparent="'.$id_record.'" data-selected="'.implode(';', $selezione).'" id="'.$table_id.'" width="100%" class="main-records'.(!empty($id_plugin) ? '-plugins' : '').' table table-condensed table-bordered">
|
||||
<thead>
|
||||
<tr>
|
||||
<th id="th_selector"></th>';
|
||||
|
Loading…
x
Reference in New Issue
Block a user