gamonoid / icehrm

Manage your employees easily with a robust and efficient Human Resource Management System
http://icehrm.com
Other
565 stars 367 forks source link

Previous and Next button events of DataTables component are invalid #353

Open jiangxuguang opened 2 months ago

jiangxuguang commented 2 months ago

The Previous and Next buttons of the DataTables component introduced in the system are invalid.

eg: 截屏2024-05-08 16 09 04

Temporary solution:

const dataTableParams = {
    ...
};
// define table
const table = $(`#${elementId} #grid`).dataTable(dataTableParams);
$('.dataTables_paginate ul').addClass('pagination');
// Manually add click events
$('.dataTables_paginate .pagination li').on('click', (event) => {
    if ($(event.currentTarget).hasClass('disabled')) {
        return;
    }
    if ($(event.currentTarget).hasClass('next')){
        table.fnPageChange( 'next' );
    }
    if ($(event.currentTarget).hasClass('prev')) {
        table.fnPageChange( 'previous' );
    }
});
...