-3
預先感謝您的任何反饋!AJAX調用相同的功能不會返回超過50條記錄
我需要調用相同的函數來加載數組。我正在使用分頁大小爲50來檢索信息。儘管如此,它只返回前50,而沒有其他。
//CALLING FUNCTION
vm.audit.load(null, null, null, null, dateTime, null, null, 1, 50, null, null, 1000, null);
//FUNCTION
o.load = function (applicationID, auditTypeID, auditUser, ipAddress, startDate, endDate, auditDescription, pageOffset, pageSize, orderBy, orderByDirection, pageMax, vthat) {
var that;
if (pageOffset === 1) {
that = this;
} else {
that = vthat;
}
//var that = this;
var dateTime = new Date();
var def = $.Deferred();
// def.async = true;
that._isLoading = true;
//var pageOffset = 1
var vDel = false;
audit.da.auditItems_get(applicationID, auditTypeID, auditUser, ipAddress, startDate, endDate, auditDescription, pageOffset, pageSize, orderBy, orderByDirection).done(function (eResult) {
var items = eResult.d.auditItems;
vCount = eResult.d.totalCount;
that.set("tCount", vCount);
if (pageOffset === 1)
{
vDel = true;
if (vCount < pageMax) {
pageMax = vCount;
}
} else {
vDel = false;
}
that.addArray(items, null, vDel);
pageOffset += pageSize;
if (pageOffset < pageMax) o.load(applicationID, auditTypeID, auditUser, ipAddress, startDate, endDate, auditDescription, pageOffset, pageSize, orderBy, orderByDirection, pageMax, that);
def.resolve(that);
}).fail(function (error) {
if (init.onerror) init.onerror({ source: that, sourceType: that._name, error: error });
def.resolve(that);
}).always(function() {
that._isloading = false;
//if (init.onloading) init.onloading({ source: that, sourceType: that._name, isLoading: false });
});
return def.promise();
};
我被要求從數據庫中提取50條記錄。這就是爲什麼我需要反覆調用這個函數。 –