No limit on serverside entries

No limit on serverside entries

SamulSamul Posts: 4Questions: 1Answers: 0

Hello

I have a table i'm loading data into but the full data set is showing rather than just 10 at a time.

So it says "Showing 1 to 10 of 3,486 entries" but it's showing all the entries. My code is below:

$(document).ready(function() {
    $('#scheduleTable').DataTable( {
        "autoWidth": false,
        "processing": true,
        "serverSide": true,
        "paging": true,
        "ajax": {
            "url": "../json/jsonSchedule.php",
            "type": "POST"
        }
    } );
} );

The table is populating correctly and there are no console errors.

This question has an accepted answers - jump to answer

Answers

  • tangerinetangerine Posts: 3,348Questions: 36Answers: 394

    Is there any kind of "limit" clause in your server-side code?

  • SamulSamul Posts: 4Questions: 1Answers: 0
    edited June 2017

    There isn't. From looking at the examples they didn't seem to have these... What would be my best method for getting this to work? Are there any examples on the site?

    Thanks

  • tangerinetangerine Posts: 3,348Questions: 36Answers: 394

    The most basic example is here:
    https://datatables.net/examples/server_side/simple.html
    See under the "Server-side script" tab.

    You'll also need the ssp.class.php file.
    https://datatables.net//forums/discussion/41720
    Note that the ssp class is only intended as an example. You may need more sophisticated stuff depending on your needs, but this would get you up and running.

  • SamulSamul Posts: 4Questions: 1Answers: 0

    I've seen this example and am already using ssp.class to generate my json. Will I have to customise the ssp class to do what i want?

  • allanallan Posts: 61,667Questions: 1Answers: 10,096 Site admin
    Answer ✓

    If you are using server-side processing with your own server-side script, you will need to read this page.

    However, you should perhaps first question if you need server-side processing: see here.

    Allan

  • SamulSamul Posts: 4Questions: 1Answers: 0

    I did not need server-side processing. Thanks for the help guys.

This discussion has been closed.