How to limit loaded data?

How to limit loaded data?

Haris FraneHaris Frane Posts: 3Questions: 1Answers: 0
edited March 2020 in Free community support

I'm new to datatables and I can't seem to figure out how to limit the load of data in the datatable with server size processing.
Ex: Load 200 rows from 500,000 rows. When it reaches the last row, it would reload the next set of rows making it 200 to 400 rows

I'm using ruby on rails and this is my current DataTable setup:

   $(document).ready(function(){
    var table = $("#tbl_server_side").DataTable({
      "serverSize": true,
      "processing": true,
      "deferRender": true,
      "ajax": {
        "url": '/item_json',
        "type": 'GET',
      }, 
      "lengthMenu": [[10, 25, 50, -1], [10, 25, 50, "All"]],
      "columns": [
        {"data": "id"},
        {"data": "item_origin"},
        {"data": "itemable_id"},
        {"data": "category"},
        {"data": "spec.name"},
        {"data": "spec.brand"},
        {"data": "spec.model"},
        {"data": "spec.frame_size"},
        {"data": "spec.wheel_size"},
        {"data": "color"},
        {"data": "quantity"},
        {"data": "cost"},
        {"data": "price"},
      ],

    });
    $('select').formSelect();
  });

Answers

This discussion has been closed.