By default, this function works with $_GET
. Based on in this discussion, I changed this function and got something like below. Now the problem is that Firebug reports an error
json.aaData undefined @line 99
Here is the line (located at the end of the code):
json.aaData.splice( 0, iRequestStart-oCache.iCacheLower );
PHP's counterpart is responding, and this table is 100% working without pipelining. But when I allow the pipeline to get this error:
http://screencast.com/t/GOJzPHq3kg
function fnDataTablesPipeline ( sSource, aoData, fnCallback ) { var iPipe = 5; var bNeedServer = false; var sEcho = fnGetKey(aoData, "sEcho"); var iRequestStart = fnGetKey(aoData, "iDisplayStart"); var iRequestLength = fnGetKey(aoData, "iDisplayLength"); var iRequestEnd = iRequestStart + iRequestLength; oCache.iDisplayStart = iRequestStart; if ( oCache.iCacheLower < 0 || iRequestStart < oCache.iCacheLower || iRequestEnd > oCache.iCacheUpper ) { bNeedServer = true; } if ( oCache.lastRequest && !bNeedServer ) { for( var i=0, iLen=aoData.length ; i<iLen ; i++ ) { if ( aoData[i].name != "iDisplayStart" && aoData[i].name != "iDisplayLength" && aoData[i].name != "sEcho" ) { if ( aoData[i].value != oCache.lastRequest[i].value ) { bNeedServer = true; break; } } } } oCache.lastRequest = aoData.slice(); if ( bNeedServer ) { if ( iRequestStart < oCache.iCacheLower ) { iRequestStart = iRequestStart - (iRequestLength*(iPipe-1)); if ( iRequestStart < 0 ) { iRequestStart = 0; } } oCache.iCacheLower = iRequestStart; oCache.iCacheUpper = iRequestStart + (iRequestLength * iPipe); oCache.iDisplayLength = fnGetKey( aoData, "iDisplayLength" ); fnSetKey( aoData, "iDisplayStart", iRequestStart ); fnSetKey( aoData, "iDisplayLength", iRequestLength*iPipe ); jQuery.post( sSource, aoData, function (data) { oCache.lastJson = jQuery.extend(true, {}, data); if ( oCache.iCacheLower != oCache.iDisplayStart ) { data.aaData.splice( 0, oCache.iDisplayStart-oCache.iCacheLower ); } data.aaData.splice( oCache.iDisplayLength, data.aaData.length ); fnCallback(data) },"json" ); } else { json = jQuery.extend(true, {}, oCache.lastJson); json.sEcho = sEcho; json.aaData.splice( 0, iRequestStart-oCache.iCacheLower );
What am I missing? Any suggestion?