|
@@ -402,17 +402,15 @@ $(document).ready(function () {
|
|
|
.then(data => {
|
|
.then(data => {
|
|
|
console.log("data",data);
|
|
console.log("data",data);
|
|
|
API_DATA = data;
|
|
API_DATA = data;
|
|
|
- if(data.length > 0){
|
|
|
|
|
- renderAttributeTable(API_DATA);
|
|
|
|
|
- // 2. ONLY THEN, initialize DataTables
|
|
|
|
|
- if (jQuery.fn.DataTable) { // Optional safety check
|
|
|
|
|
- jQuery('#product-attribute-list').DataTable({
|
|
|
|
|
- // Ensure the table structure is maintained if you re-render
|
|
|
|
|
- destroy: true
|
|
|
|
|
- });
|
|
|
|
|
- } else {
|
|
|
|
|
- console.error("DataTables plugin not loaded.");
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ renderAttributeTable(API_DATA);
|
|
|
|
|
+ // 2. ONLY THEN, initialize DataTables
|
|
|
|
|
+ if (jQuery.fn.DataTable) { // Optional safety check
|
|
|
|
|
+ jQuery('#product-attribute-list').DataTable({
|
|
|
|
|
+ // Ensure the table structure is maintained if you re-render
|
|
|
|
|
+ destroy: true
|
|
|
|
|
+ });
|
|
|
|
|
+ } else {
|
|
|
|
|
+ console.error("DataTables plugin not loaded.");
|
|
|
}
|
|
}
|
|
|
jQuery('#full-page-loader').hide();
|
|
jQuery('#full-page-loader').hide();
|
|
|
});
|
|
});
|
|
@@ -429,7 +427,8 @@ function renderAttributeTable(apiData) {
|
|
|
$dataBody.empty(); // Clear existing rows
|
|
$dataBody.empty(); // Clear existing rows
|
|
|
|
|
|
|
|
if (!apiData || apiData.length === 0) {
|
|
if (!apiData || apiData.length === 0) {
|
|
|
- $dataBody.append('<tr><td colspan="4">No product attributes found.</td></tr>');
|
|
|
|
|
|
|
+ $dataBody.append('<tr><td colspan="3">No product attributes found.</td></tr>');
|
|
|
|
|
+ jQuery('#full-page-loader').hide();
|
|
|
return;
|
|
return;
|
|
|
}
|
|
}
|
|
|
|
|
|