How to fix pageLength after html change?

How to fix pageLength after html change?

klim30klim30 Posts: 1Questions: 1Answers: 0

I use datatable with Backbone.marionette. First showng is working correct. After data fetch table show all items, but I need to show 8 items always.

onAttach() {
$('#table').DataTable({
searching: false,
lengthChange: false,
pageLength: 8,
saveState: true,
language: {
info: "START - END из TOTAL",
infoEmpty: "",
paginate: {
"next": "next",
"previous": "previous"
},
}
});
},

Answers

  • colincolin Posts: 15,144Questions: 1Answers: 2,586

    If you're adding the data straight into the DOM's HTML you'll need to re-initialise the table, otherwise DataTables won't know it's there.

    If that doesn't help, we're happy to take a look, but as per the forum rules, please link to a test case - a test case that replicates the issue will ensure you'll get a quick and accurate response. Information on how to create a test case (if you aren't able to link to the page you are working on) is available here.

    Cheers,

    Colin

This discussion has been closed.