Get 2024 Templates Mega Bundle!$1000 worth of 19 Bootstrap HTML, Vue & React Templates + 3 Vector Sets for just $99
Get for 99$

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: "http://localhost/admin/data.php",
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
Here's a how to add some HTML formatting to your comment:
  • <pre></pre> for JS codes block
  • <pre lang="html"></pre> for HTML code block
  • <pre lang="scss"></pre> for SCSS code block
  • <pre lang="php"></pre> for PHP code block
  • <code></code> for single line of code
  • <strong></strong> to make things bold
  • <em></em> to emphasize
  • <ul><li></li></ul>  to make list
  • <ol><li></li></ol>  to make ordered list
  • <h3></h3> to make headings
  • <a></a> for links
  • <img> to paste in an image
  • <blockquote></blockquote> to quote somebody
  • 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
Here's a how to add some HTML formatting to your comment:
  • <pre></pre> for JS codes block
  • <pre lang="html"></pre> for HTML code block
  • <pre lang="scss"></pre> for SCSS code block
  • <pre lang="php"></pre> for PHP code block
  • <code></code> for single line of code
  • <strong></strong> to make things bold
  • <em></em> to emphasize
  • <ul><li></li></ul>  to make list
  • <ol><li></li></ol>  to make ordered list
  • <h3></h3> to make headings
  • <a></a> for links
  • <img> to paste in an image
  • <blockquote></blockquote> to quote somebody
  • happy  :)
  • shocked  :|
  • sad  :(
Text formatting options
Submit
Here's a how to add some HTML formatting to your comment:
  • <pre></pre> for JS codes block
  • <pre lang="html"></pre> for HTML code block
  • <pre lang="scss"></pre> for SCSS code block
  • <pre lang="php"></pre> for PHP code block
  • <code></code> for single line of code
  • <strong></strong> to make things bold
  • <em></em> to emphasize
  • <ul><li></li></ul>  to make list
  • <ol><li></li></ol>  to make ordered list
  • <h3></h3> to make headings
  • <a></a> for links
  • <img> to paste in an image
  • <blockquote></blockquote> to quote somebody
  • happy  :)
  • shocked  :|
  • sad  :(