Ajax data pipeline changed

Ajax data pipeline changed

dreamer79dreamer79 Posts: 14Questions: 0Answers: 0
edited February 2012 in General
Examples are written for using one table on a page only. I use many tables on a page and even more with ones created inside modal dialogs. So here is a little rewritten pipeline code to handle a cache for each grid on a page. I've removed the 5 pages parameter and set a length of 750 records(I use tables that change their rows on windows resize to fit a part of screen so sometimes I have 10 rows and the next time- 20.). In this code there is also a fixe as the original example had a bad problem- it tried to read from server, but before receiving data the dataTable tried to draw information from cache. In that case there was an error- you have no data in cache, iDraw(internal variable for checking if server has sent something that is too old to be displayed) is bigger with the new request and the old one is not parsed. The main difference in fact is using cache that is a property of tables own settings object. I think using examples with oTable for the api is not a good idea as many people out there just won't know how to rewrite code for many tables on a page.

[code]

function fnSetKey( aoData, sKey, mValue )
{
for ( var i=0, iLen=aoData.length ; i

Replies

  • stevensmarkdstevensmarkd Posts: 1Questions: 0Answers: 0
    What does your .dataTable() initialization look like for this version?

    Just an example of how you are passing in oSettings with setting the fnServerData would be helpful.

    This is the one from the original pipeline example:

    [code]
    $(document).ready(function() {
    $('#example').dataTable( {
    "bProcessing": true,
    "bServerSide": true,
    "sAjaxSource": "scripts/server_processing.php",
    "fnServerData": fnDataTablesPipeline
    } );
    } );
    [/code]
This discussion has been closed.