Pagination not working for Server Side Data

Pagination not working for Server Side Data

snukalasnukala Posts: 7Questions: 0Answers: 0
edited June 2012 in Plug-ins
http://debug.datatables.net/emuyit

Hi All,
I am new to Datatables, found this very very useful. I reviwed the examples and created something that I need combining multiple features
1. Pagination (full page numbers)
2. Server Side Data (Using php server script)
3. Export to PDF, CSV, Print buttons
4. Wanted to have the "Change Columns" but that conflicts with the Buttons in #3 could not get that to work
5. Column Filtering
6. Form Sumbit for each row (Modified the server script in #2 to send Form, Input and Button tags with the data that achieves the result I want
7. Would like to integrate Edit and Delete to this (Not done yet)

So I was able to do 1,2,3,5,6

But Pagination is not working properly if I replace my Server based data source with static data source it works, I am just testing on non fileterd output, so iTotalDisplayRecords. iTotalDisplayRecords are the the same which is the count of total rows.

The pagination shows
Showing 1 to NaN of NaN entries (filtered from NaN total entries) First Previous 1 2 3 4 5 Next Last

Issues
1. Showing 1 to NaN of NaN entries
2. The Next Button is not working
3. The test table has 57 records, when I click page 5 it shows me 6,7 8, and when I hit LAST it gives me a Json Error.
Somehow it is not able to establish the last page.

Here is the output generated by the server side script (I truncated this for space constraints on this post)

{"sEcho":1,"iTotalRecords":{"COUNT(`id`)":"57"},"iTotalDisplayRecords":{"FOUND_ROWS()":"57"},"aaData":[["Gecko","Firefox 1.0","Win 98+ \/ OSX.2+","\n \n \n \n 1.7\n <\/form>","A"],["Gecko","Firefox 1.5","Win 98+ \/ OSX.2+","\n
value=\"Edit\">\n \n 1.8\n <\/form>","A"],["Gecko","Mozilla 1.0","Win 95+ \/ OSX.1+","\n \n \n \n 1\n <\/form>","A"]]}

I need help in fixing the pagination.

Replies

  • snukalasnukala Posts: 7Questions: 0Answers: 0
    I fixed the issue. It was my fault in the Server Side script, the values for
    "iTotalRecords":{"COUNT(`id`)":"57"},"
    iTotalDisplayRecords":{"FOUND_ROWS()":"57"},
    I fixed this to just send 57 and it works.
    "iTotalRecords":"57",
    "iTotalDisplayRecords":"57"

    Now I would like to know how I can Add the "Change Fields"
    http://datatables.net/release-datatables/extras/ColVis/exclude_columns.html
    [code]

    $(document).ready( function () {
    $('#example').dataTable( {
    "sDom": 'C<"clear">lfrtip',
    "oColVis": {
    "aiExclude": [ 0 ]
    }
    } );
    } );
    [/code]
    The button here conflicts with the
    http://datatables.net/release-datatables/extras/TableTools/multi_instance.html
    [code]
    $(document).ready( function () {
    $('#example').dataTable( {
    "sDom": 'T<"clear">lfrtip<"clear spacer">T'
    } );
    } );
    [/code]

    I can get only one of these on the table, not both.

    Please let me know how I can get both these features on one Datatable

    Srinivas
This discussion has been closed.