0
다음 자바 스크립트와 함께 매끄러운 격자를 사용하고 있습니다. 문제는 컨트롤이 결코 ensureData()로 이동하지 않는다는 것입니다. 어떤 아이디어?매끄러운 격자가 데이터가 호출되지 않도록하십시오.
grid.onViewportChanged.subscribe(function (e, args) {
alert('1');
var vp = grid.getViewport();
alert('2');
loader.ensureData(vp.top, vp.bottom);
alert('3');
});
function ensureData(from, to)
{
alert('55');
var maxdata = Math.min(999, data.length);
if (from < 0)
from = 0;
if (to > maxdata)
to = maxdata;
var fromPage = Math.floor(from/PAGESIZE);
var toPage = Math.floor(to/PAGESIZE); // look-ahead
while (fromPage <= toPage) {
if (data[fromPage * PAGESIZE] == undefined) {
data[fromPage * PAGESIZE] = null; // null indicates a 'requested but not available yet'
var order = { "query": searchstr, "offset": (fromPage * PAGESIZE), "count": (((toPage - fromPage) * PAGESIZE) + PAGESIZE), "sort": sortcol, "order": ((sortdir > 0) ? "asc" : "desc") };
req = $.ajax({
type: "POST",
contentType: "application/json; charset=utf-8",
dataType: "json",
data: JSON.stringify(order),
url: "OrderService.svc/GetOrderList",
success: onSuccess,
error: function (jqXHR, textStatus, errorThrown) {
if (textStatus != 'abort')
onError(fromPage, toPage);
}
});
onDataLoading.notify();
}
fromPage++;
}
}
경고 1