From 3ce842b52db917f887a62587525dbcd7135dc114 Mon Sep 17 00:00:00 2001 From: Hash Borgir Date: Tue, 13 Jun 2023 13:42:32 -0600 Subject: [PATCH] row appending properly and gonig to last page --- TblEditorGUI.php | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/TblEditorGUI.php b/TblEditorGUI.php index d40a40a..4939112 100644 --- a/TblEditorGUI.php +++ b/TblEditorGUI.php @@ -124,15 +124,15 @@ foreach (glob($tbl . "*.tbl") as $filename) { // // Initialize DataTables on the table // $('.table').DataTable(); // }); -// }); +// }); -// Function to resize textarea based on content + // Function to resize textarea based on content function resizeTextarea() { this.style.height = 'auto'; this.style.height = (this.scrollHeight) + 'px'; } -// Select element change event handler + // Select element change event handler $('#tableName').change(function () { $('.table').DataTable().destroy(); $('.table tbody').html(''); @@ -170,7 +170,7 @@ foreach (glob($tbl . "*.tbl") as $filename) { -// Delete link click event handler + // Delete link click event handler $(document).on('click', '.delete-link', function (event) { event.preventDefault(); @@ -239,7 +239,7 @@ foreach (glob($tbl . "*.tbl") as $filename) { '' + '
' + 'Update' + - 'Delete' + + 'Delete' + '
' + ''; ; @@ -250,7 +250,11 @@ foreach (glob($tbl . "*.tbl") as $filename) { $('.table tbody').append(newRow); - $('.table').DataTable(); + // Initialize DataTables on the table + var table = $('.table').DataTable(); + + // Go to the last page after loading the table + table.page('last').draw('page'); }); });