我使用的是qooxdoo 3.5,但我在3.0.1上的情况相同。
根据the example from docs构建远程表。
在陈述类中,我不使用antyhing花式。问题是当数据行超过 BlockSize 时,会生成空行。使用 reloadData 之后,所有内容都已正确填充。问题是使用 reloadData 效率不高。您是否遇到了预取和缓存数据的类似问题?
远程表模型:
qx.Class.define("atms.RemoteTableCases",
{
extend : qx.ui.table.model.Remote,
include: [qx.locale.MTranslation],
properties :
{
test: {
init: '',
nullable: true,
event: "changeTest"
},
param :
{
init : "?query=",
check : "String"
}
},
construct : function()
{
this.base(arguments);
var colnames = {
"status" : this.tr("Status"),
"user" : this.tr("Assigned to"),
"name" : this.tr("Case Name"),
"expected_time": this.tr("Expected time"),
"result_time" : this.tr("Result time"),
"weight" : this.tr("Impact factor")
};
var col_keys = new Array();
var col_values = new Array();
for (var key in colnames) {
col_keys.push(key);
col_values.push(colnames[key]);
}
this.base(arguments);
this.setColumns(col_values, col_keys);
this.__colKeys = col_keys;
this.setColumnSortable(0, true);
this.setBlockSize(4);
this.__setupResources();
},
members :
{
__colKeys: null,
__setupResources: function() {
this.__rows = new qx.io.rest.Resource({
"get" : { method: "GET", url: SERVER + "get_cases_count.json/{id}" },
"getCases" : { method: "GET", url: SERVER + "get_cases.json/{test}{param}" }
});
this.__rows.addListener('getSuccess', function(e) {
this._onRowCountCompleted(e.getData().content);
}, this);
this.__rows.addListener('getCasesSuccess', function(e) {
this._onLoadRowDataCompleted(e.getData().content);
}, this);
},
_loadRowCount : function() { this.__rows.get({id:this.getTest()}); },
_onRowCountCompleted : function(result)
{
if (result != null) {
this._onRowCountLoaded(result);
}
},
_loadRowData : function(firstRow, lastRow) {
var parameters = "?from=" + firstRow + "&to=" + lastRow;
var sortIndex = this.getSortColumnIndex() == -1 ?
'null' : this.__colKeys[this.getSortColumnIndex()];
var sortOrder = this.isSortAscending() ? "asc" : "desc";
parameters += "&sortOrder=" + sortOrder + "&sortIndex=" + sortIndex;
this.__rows.getCases({
test: this.getTest(),
param: parameters
});
},
_onLoadRowDataCompleted : function(result)
{
if (result != null) {
this._onRowDataLoaded(result);
}
}
}
});
答案 0 :(得分:0)
请确保方法调用_ onRowDataLoaded 中加载的数据完全对应_ loadRowData:function( firstRow ,>所请求的数据范围LASTROW 强>)