static/js/datable.js
/**
 * Initialize data table controls.
 * @function initDataTableCtrl
 * @param {Object} mo - main object
 */
Initialize data table controls.
@function initDataTableCtrl
@param {Object} mo - main object
Initialize data table controls . @function initDataTableCtrl @param { Object } mo - main object
function initDataTableCtrl(mo) {
  byId('export-table-btn').addEventListener('click', function () {
    exportDataTable(mo);
  });
  byId('data-prev-btn').addEventListener('click', function () {
    const table = byId('data-table');
    let n = parseInt(table.getAttribute('data-nctg')),
        p = parseInt(table.getAttribute('data-ipage'));
    fillDataTable(mo, undefined, n, p - 1);
  });
  byId('data-next-btn').addEventListener('click', function () {
    const table = byId('data-table');
    let n = parseInt(table.getAttribute('data-nctg')),
        p = parseInt(table.getAttribute('data-ipage'));
    fillDataTable(mo, undefined, n, p + 1);
  });
  byId('data-page-txt').addEventListener('keyup', function (e) {
    if (e.key === 'Enter') {
      const table = byId('data-table');
      const p = parseInt(this.value);
      const P = parseInt(table.getAttribute('data-npage'));
      if (!Number.isNaN(p) && p >= 1 && p <= P) {
        const n = parseInt(table.getAttribute('data-nctg'));
        fillDataTable(mo, undefined, n, p - 1);
      } else {
        this.value = parseInt(table.getAttribute('data-ipage')) + 1;
      }
    };
  });
}
function initDataTableCtrl ( mo ) { byId ( 'export-table-btn' ) . addEventListener ( 'click' , function ( ) { exportDataTable ( mo ) ; } ) ; byId ( 'data-prev-btn' ) . addEventListener ( 'click' , function ( ) { const table = byId ( 'data-table' ) ; let n = parseInt ( table . getAttribute ( 'data-nctg' ) ) , p = parseInt ( table . getAttribute ( 'data-ipage' ) ) ; fillDataTable ( mo , undefined , n , p - 1 ) ; } ) ; byId ( 'data-next-btn' ) . addEventListener ( 'click' , function ( ) { const table = byId ( 'data-table' ) ; let n = parseInt ( table . getAttribute ( 'data-nctg' ) ) , p = parseInt ( table . getAttribute ( 'data-ipage' ) ) ; fillDataTable ( mo , undefined , n , p + 1 ) ; } ) ; byId ( 'data-page-txt' ) . addEventListener ( 'keyup' , function ( e ) { if ( e . key === 'Enter' ) { const table = byId ( 'data-table' ) ; const p = parseInt ( this . value ) ; const P = parseInt ( table . getAttribute ( 'data-npage' ) ) ; if ( ! Number . isNaN ( p ) && p >= 1 && p <= P ) { const n = parseInt ( table . getAttribute ( 'data-nctg' ) ) ; fillDataTable ( mo , undefined , n , p - 1 ) ; } else { this . value = parseInt ( table . getAttribute ( 'data-ipage' ) ) + 1 ; } } ; } ) ; }
Initialize data table controls.
Initialize data table controls .
// menu button click (same as context menu) // move to previous page // move to next page // enter page number and jump