Super Sale Limited Time 50% OFF for All-Access Plans
Save 50% Now

About Datatables Error


Hello, metronic 7 also does not work in metron 8 from this code. I get a warning as "No data available in table". How can I fix this?


function productTable() {
(function() {
var t;
t = $(".m_datatable").DataTable( {
data: {
type: "remote",
source: {
read: {
url: "
map: function(t) {
var a = t;
return $(".total-stock strong").html(t.la.stock), setTimeout(function() {
$("a[data-target="_blank"]").attr("target", "_blank")
}, 500), void 0 !== t.data && (a = t.data), a
}
}
}
},
columns: [{
autoHide: !1,
field: "ID",
title: "#",
sortable: !1,
width: 20,
selector: {
class: "kt-checkbox kt-checkbox--bold kt-checkbox--brand lag-table-check-ids lag-table-check-remove lag-table-change-cat lag-table-change-brand lag-table-change-product-ban lag-table-change-product-status lag-table-change-product-attribute lag-table-change-product-special-field"
}
}, {
autoHide: !1,
field: "ID2",
title: "Ürün No",
width: 60,
template: function(t) {
return "<a class="item-id text-primary" data-table="urun" data-laonclick="shoNativeModal(\"product\"," + t.ID + ", true)" href="javascript:;">" + t.ID + "</a>"
}
}, {
autoHide: !1,
field: "image",
title: "Resim",
width: 60,
textAlign: "center",
template: function(t) {
return "<img src="" + t.image_thumb + "" data-big="" + t.image_big + "" class="image-hoverable" />"
}
}
]
});
})()
}


data.php

{
"meta": { "field": "ID", "page": "1", "pages": "10", "perpage": "10", "sort": "DESC", "total": "2" },
"la": { "stock": "40" },
"data": [
{
"ID": "1",
"alis_fiyat": "1",
"alis_fiyat_o": "2",
"barcode": "3",
"category": "1",
"categoryID": "2",
"csPrice_o": "12",
"csStatus": "1",
"desi": "1",
"epttavmPrice": "1",
"epttavmPrice_o": "",
"epttavmStatus": "",
"hepsiburadaPrice": "",
"hepsiburadaPrice_o": "",
"hepsiburadaStatus": "",
"image_big": "/cdn/0/d/d/images/urunler/1.png",
"image_thumb": "/cdn/2/150/150/images/urunler/1.png",
"invoiceName": "",
"liveSalePrice": "",
"liveSalePrice_o": "",
"mwsPrice": "",
"mwsPrice_o": "",
"mwsStatus": "",
"n11Price": "",
"n11Price_o": "",
"n11Status": "",
"name": "Deneme \u00dcr\u00fcn\u00fc",
"piyasafiyat": "",
"piyasafiyat_o": "",
"sitePrice": "145.00 TL",
"sitePrice_o": "145.00",
"siteStatus": "1",
"spPrice": "",
"spPrice_o": "",
"spStatus": "",
"stock": "0",
"stok_end_date": "2020-12-04 01:05:00",
"tyPrice": "",
"tyPrice_o": "",
"tyStatus": "",
"url": "",
"urunKodu": ""
},
{
"ID": "2",
"alis_fiyat": "",
"alis_fiyat_o": "",
"barcode": "",
"category": "",
"categoryID": "",
"csPrice_o": "",
"csStatus": "",
"desi": "",
"epttavmPrice": "",
"epttavmPrice_o": "",
"epttavmStatus": "",
"hepsiburadaPrice": "",
"hepsiburadaPrice_o": "",
"hepsiburadaStatus": "",
"image_big": "",
"image_thumb": "",
"invoiceName": "",
"liveSalePrice": "",
"liveSalePrice_o": "",
"mwsPrice": "",
"mwsPrice_o": "",
"mwsStatus": "",
"n11Price": "",
"n11Price_o": "",
"n11Status": "",
"name": "Deneme \u00dcr\u00fcn 2",
"piyasafiyat": "",
"piyasafiyat_o": "",
"sitePrice": "20.00 TL",
"sitePrice_o": "20.00",
"siteStatus": "1",
"spPrice": "",
"spPrice_o": "",
"spStatus": "",
"stock": "40",
"stok_end_date": "0000-00-00 00:00:00",
"tyPrice": "",
"tyPrice_o": "",
"tyStatus": "",
"url": "",
"urunKodu": ""
}
]
}


Text formatting options
Submit
Click any option to insert into your comment. Select text first to wrap it.
  • **text** to make things bold
  • *text* to emphasize
  • ### Heading to make headings
  • [link text](url) for links
  • ![alt text](image-url) to paste in an image
  • - item to make a list
  • 1. item to make an ordered list
  • > quote to quote somebody
  • `code` for single line of code
  • ```js ... ``` for JS code block
  • ```html ... ``` for HTML code block
  • ```scss ... ``` for SCSS code block
  • ```php ... ``` for PHP code block
  • --- for a horizontal rule
  • happy  :)
  • shocked  :|
  • sad  :(

Replies (1)


Hi,

If you are using Metronic v8 can you please try to refer to the official example of ajax server side data.

Regards.


Text formatting options
Submit
Click any option to insert into your comment. Select text first to wrap it.
  • **text** to make things bold
  • *text* to emphasize
  • ### Heading to make headings
  • [link text](url) for links
  • ![alt text](image-url) to paste in an image
  • - item to make a list
  • 1. item to make an ordered list
  • > quote to quote somebody
  • `code` for single line of code
  • ```js ... ``` for JS code block
  • ```html ... ``` for HTML code block
  • ```scss ... ``` for SCSS code block
  • ```php ... ``` for PHP code block
  • --- for a horizontal rule
  • happy  :)
  • shocked  :|
  • sad  :(
Text formatting options
Submit
Click any option to insert into your comment. Select text first to wrap it.
  • **text** to make things bold
  • *text* to emphasize
  • ### Heading to make headings
  • [link text](url) for links
  • ![alt text](image-url) to paste in an image
  • - item to make a list
  • 1. item to make an ordered list
  • > quote to quote somebody
  • `code` for single line of code
  • ```js ... ``` for JS code block
  • ```html ... ``` for HTML code block
  • ```scss ... ``` for SCSS code block
  • ```php ... ``` for PHP code block
  • --- for a horizontal rule
  • happy  :)
  • shocked  :|
  • sad  :(