Server Side Issues

Server Side Issues

samlsaml Posts: 8Questions: 0Answers: 0
edited July 2009 in General
For some reason I can't get the server side data tables working.

This works: http://masterloggercertification.com/media/examples_support/server_processing.php
But the table will not populate: http://masterloggercertification.com/dir-test.php

Thanks in advance for your help with this.
sam

Replies

  • Nubby9.5Nubby9.5 Posts: 2Questions: 0Answers: 0
    Sam

    I noted three things on you dir-test page:
    1. You import the custom demos.css twice. (This does not cause a problem.)
    2. The jquery.datatables.js is the first culprit!
    3. DOM Statement "dPaginate": false is the second!

    If you make the following changes, your datatable will work:
    1.Upgrade media/js/jquery.datatables.js to version 1.5 beta 11
    (http://datatables.net/releases/dataTables-1.5.beta.11.zip)
    2.Change the DOM Statement to:
    [code]

    $(document).ready(function() {
    $('#example').dataTable( {
    "bPaginate": true,
    "bProcessing": true,
    "bServerSide": true,
    "sAjaxSource": "media/examples_support/server_processing.php"
    } );
    } );

    [/code]

    I'm not sure why turning the bPaginate feature to off causes the table to not populate but I will guess that it is probably because your table has more than 100 records.

    Hope that helps,
    Jason
  • samlsaml Posts: 8Questions: 0Answers: 0
    Hi Jason-

    Thanks for the help with this, that got it working.

    Next question... is it possible to reformat the items to more than one line per entry?
    See this example: http://masterloggercertification.com/directory.php

    Thanks,
    sam
  • allanallan Posts: 63,578Questions: 1Answers: 10,483 Site admin
    Hi Sam,

    Yes indeed you can reform your data. If you know the format you want on the server-side, then you can just output the required HTML (a few bold tags and a couple of BRs looks like is all that is needed).

    Alternatively, if you don't know this on the server-side, you can use DataTables' fnRender option for columns: datatables.net/usage#fnRender

    Regards,
    Allan
This discussion has been closed.