默認情況下,此功能與$_GET
一起使用。基於on this discussion我修改了this function,並得到如下所示。現在的問題是,螢火蟲給出錯誤信息帶流水線的服務器端處理
json.aaData is undefined @ line 99
這裏是線(位於底碼):
json.aaData.splice(0, iRequestStart-oCache.iCacheLower);
PHP側響應,並在此表工程100%,無流水線。但是,當我實現流水線操作收到此錯誤:
http://screencast.com/t/GOJzPHq3kg
function fnDataTablesPipeline (sSource, aoData, fnCallback) {
var iPipe = 5; /* Ajust the pipe size */
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;
/* outside pipeline? */
if (oCache.iCacheLower < 0 || iRequestStart < oCache.iCacheLower || iRequestEnd > oCache.iCacheUpper)
{
bNeedServer = true;
}
/* sorting etc changed? */
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;
}
}
}
}
/* Store the request for checking next time around */
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) {
/* Callback processing */
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; /* Update the echo for each response */
json.aaData.splice(0, iRequestStart-oCache.iCacheLower); // <- this line
json.aaData.splice(iRequestLength, json.aaData.length);
fnCallback(json);
return;
}
}
我缺少什麼?任何建議?