0

我对 YUI 分页组件有疑问。我有使用分页的数据表。从服务器返回 10 条记录(例如)和“haseMorePages”元字段。如果此字段为真,那么我将 oPayload.totalRecords 设置为 11(用于激活“下一步”分页器按钮)

 dataTable = new YAHOO.widget.DataTable(me.id + "-datatable", columnDefs, dataSource,
    {dynamicData: false,
    initialLoad: true,
    initialRequest: generateRequest(),
    paginator: timelinePaginator});
 timelinePaginator = new YAHOO.widget.Paginator({
                         rowsPerPage: 10,
                         alwaysVisible: true,
                         containers: me.id + "-paginator"
                         });
dataTable.handleDataReturnPayload = function (oRequest, oResponse, oPayload) {
  var resultLength = oResponse.results.length;
  oPayload = oPayload || {};
  oPayload.totalRecords = (oResponse.meta.hasMorePage) ? (resultLength + 1) :       resultLength;
return oPayload;
};

但它不起作用!我尝试了很多变种,但没有。如果有人知道如何使它工作,请回答。谢谢!

4

0 回答 0