Data table pagination not showing

Data table pagination not showing

madusankamadusanka Posts: 20Questions: 7Answers: 0
edited November 2019 in Free community support

how to apply pagination option in this code? I have attached a screenshot of current page

self.dataTable = $("#booking_list").DataTable({
              serverSide: true,
              paging: true,
              info: true,
              ajax: {
                  data: {
                      "token": localStorage.getItem("token"),
                  },
                  url: 'api/v1/bookings',           

                  dataFilter: function (data) {
                      var json = jQuery.parseJSON( data );
                      var resellerreponce = json.data.searchResults;
                      self.bookings = resellerreponce.bookings;
                      json.data = resellerreponce.bookings;
                      json.recordsFiltered = resellerreponce.recordsFiltered;
                      json.recordsTotal = resellerreponce.recordsTotal;
                      console.log(json);
                      return JSON.stringify( json );
                  }
              },

This question has an accepted answers - jump to answer

Answers

  • madusankamadusanka Posts: 20Questions: 7Answers: 0
    edited November 2019

    this is the json

    data: (10) […]
    
    ​length: 10
    ​​
    <prototype>: Object { … }
    ​
    msg: ""
    ​
    recordsFiltered: 10
    ​
    recordsTotal: 44
    ​
    status: true
    
  • colincolin Posts: 15,237Questions: 1Answers: 2,598
    Answer ✓

    Your recordsFiltered: 10 is saying there are only 10 records total, so one a 10 record page, there wouldn't be paging. The protocol is discussed here, and a live examples here.

    Cheers,

    Colin

  • madusankamadusanka Posts: 20Questions: 7Answers: 0
    edited November 2019

    Thank you very much @colin .

This discussion has been closed.