mirror of
https://gitlab.com/hashborgir/d2tools.git
synced 2025-04-27 14:55:38 +00:00
loading spinner added on table load
This commit is contained in:
parent
c9c7c63abc
commit
9c4123c148
@ -40,7 +40,7 @@ foreach (glob($tbl . "*.tbl") as $filename) {
|
|||||||
<!-- <script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>-->
|
<!-- <script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>-->
|
||||||
<script src="https://cdn.datatables.net/1.11.4/js/jquery.dataTables.min.js"></script>
|
<script src="https://cdn.datatables.net/1.11.4/js/jquery.dataTables.min.js"></script>
|
||||||
<!-- Bootstrap CSS (if not already included) -->
|
<!-- Bootstrap CSS (if not already included) -->
|
||||||
<!-- <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/4.6.0/css/bootstrap.min.css">-->
|
<!-- <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/4.6.0/css/bootstrap.min.css">-->
|
||||||
|
|
||||||
<!-- Bootstrap DataTables CSS -->
|
<!-- Bootstrap DataTables CSS -->
|
||||||
<link rel="stylesheet" href="https://cdn.datatables.net/1.11.4/css/dataTables.bootstrap4.min.css">
|
<link rel="stylesheet" href="https://cdn.datatables.net/1.11.4/css/dataTables.bootstrap4.min.css">
|
||||||
@ -88,6 +88,9 @@ foreach (glob($tbl . "*.tbl") as $filename) {
|
|||||||
<hr>
|
<hr>
|
||||||
|
|
||||||
<div class="tablediv">
|
<div class="tablediv">
|
||||||
|
<div id="loading-spinner" style="display: none; text-align:center;">
|
||||||
|
<img src="img/loading.gif" alt="Loading...">
|
||||||
|
</div>
|
||||||
<table class="table">
|
<table class="table">
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
@ -111,6 +114,14 @@ foreach (glob($tbl . "*.tbl") as $filename) {
|
|||||||
this.style.height = 'auto';
|
this.style.height = 'auto';
|
||||||
this.style.height = (this.scrollHeight) + 'px';
|
this.style.height = (this.scrollHeight) + 'px';
|
||||||
}
|
}
|
||||||
|
function showLoadingSpinner() {
|
||||||
|
$('#loading-spinner').show();
|
||||||
|
}
|
||||||
|
|
||||||
|
// Hide the loading spinner
|
||||||
|
function hideLoadingSpinner() {
|
||||||
|
$('#loading-spinner').hide();
|
||||||
|
}
|
||||||
$(document).ready(function () {
|
$(document).ready(function () {
|
||||||
// Function to resize textarea based on content
|
// Function to resize textarea based on content
|
||||||
function resizeTextarea() {
|
function resizeTextarea() {
|
||||||
@ -122,7 +133,7 @@ foreach (glob($tbl . "*.tbl") as $filename) {
|
|||||||
$('#tableName').change(function () {
|
$('#tableName').change(function () {
|
||||||
$('.table').DataTable().destroy();
|
$('.table').DataTable().destroy();
|
||||||
$('.table tbody').html('');
|
$('.table tbody').html('');
|
||||||
|
showLoadingSpinner();
|
||||||
var selectedTable = $(this).val();
|
var selectedTable = $(this).val();
|
||||||
if (selectedTable !== '') {
|
if (selectedTable !== '') {
|
||||||
|
|
||||||
@ -130,6 +141,7 @@ foreach (glob($tbl . "*.tbl") as $filename) {
|
|||||||
var request = $.get('TblEditor.php', {cmd: 'getTable', tableName: selectedTable});
|
var request = $.get('TblEditor.php', {cmd: 'getTable', tableName: selectedTable});
|
||||||
|
|
||||||
request.done(function (response) {
|
request.done(function (response) {
|
||||||
|
hideLoadingSpinner();
|
||||||
// Handle the response here
|
// Handle the response here
|
||||||
$('.tablediv tbody').html(response).promise().done(function () {
|
$('.tablediv tbody').html(response).promise().done(function () {
|
||||||
// Callback function after HTML content is loaded
|
// Callback function after HTML content is loaded
|
||||||
@ -279,6 +291,8 @@ foreach (glob($tbl . "*.tbl") as $filename) {
|
|||||||
scrollbar-width: none; /* For Firefox */
|
scrollbar-width: none; /* For Firefox */
|
||||||
-ms-overflow-style: none; /* For Internet Explorer and Edge */
|
-ms-overflow-style: none; /* For Internet Explorer and Edge */
|
||||||
}
|
}
|
||||||
|
#loading-spinner {
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
Loading…
x
Reference in New Issue
Block a user