Skip to content Skip to sidebar Skip to footer

Jquery Datatables “no Data Available In Table” And Tabled Folds When Sorting

I have this error now too as per this post ”. and have modified code as per the post, but still getting the 'no data Available in Table. In addition, I have added Sort buttons, h

Solution 1:

The issue is that you're trying to do too much with your ajax. You could use something like this:

let datatable = $("#datatable").DataTable({
  "ajax": {
    "type": "POST",
    "url": "/echo/json/",
    "dataType": "json",
    "dataSrc": "rent",
    "data": {
      "json": JSON.stringify(jsonData)
    }
  },
  "columns": [{
    "title": "Date",
    "data": "datePaid",
    "render": function(d) {
      returnmoment(d).format("DD-MMM-YYYY")
    }
  }, {
    "title": "Payment",
    "data": "paymentType"
  }, {
    "title": "Amount",
    "data": "amountPaid",
    "render": function(d) {
      return"$" + d
    }
  }, {
    "title": "Balance",
    "render": function() {
      return"$0.00"
    }
  }]
});

Which lets DataTables do its own thing and KNOW about the data.

Post a Comment for "Jquery Datatables “no Data Available In Table” And Tabled Folds When Sorting"