Data table page length and start params does not synchronize with json endpoint.

Data table page length and start params does not synchronize with json endpoint.

kingtonukingtonu Posts: 3Questions: 1Answers: 0
edited January 14 in Free community support

I want to synch my json params with data table params. please help me how can i fix it.

here is my code.

var table = $('#example').DataTable( {
         serverSide: true,
         processing: true,
         pagingType: "full_numbers",
         paging: true,
         lengthMenu: [10, 25, 50, 75, 100],
            ajax: { 
                url: 'http://localhost:8080/file/myjson.do',
                dataFilter: function(data){
                var json = jQuery.parseJSON( data );
                    //this is working fine
                            json.data = json.dataList;       
                    json.recordsFiltered = json.AlldataList;
                    //
                            //the last 2 not working.
                            json.length = json.pageSize;
                    json.start =json.startIndex;                    
                    return JSON.stringify( json ); // return JSON strin        
                }
});

json response
dataList […]
AlldataList 3471
startIndex 0
pageSize 10

Answers

  • colincolin Posts: 3,310Questions: 0Answers: 589

    Hi @kingtonu ,

    This thread should help, it's asking the same thing. See Kevin's example in the final message.

    Cheers,

    Colin

  • kingtonukingtonu Posts: 3Questions: 1Answers: 0

    json.length = json.pageSize;
    json.start = json.startIndex;

    table pagination and page size not working because of this two parameters..
    how can i fix it ???

  • kingtonukingtonu Posts: 3Questions: 1Answers: 0

    data: function ( d )
    {
    d.pageSize = d.length;
    d.startIndex = d.start;
    }
    Fixed thanks i founded solution in other question

Sign In or Register to comment.