1、在Ext.data.TreeStore中添加下方的红色标记的代码
onProxyLoad: function (operation) {
var me = this,
options = operation.initialConfig,
successful = operation.wasSuccessful(),
records = operation.getRecords(),
node = options.node,
isRootLoad = options.isRootLoad,
scope = operation.getScope() || me,
args = [records, operation, successful];
if (me.destroyed) {
return;
}
me.loading = false;
node.set('loading', false);
if (successful) {
++me.loadCount;
if (!me.getClearOnLoad()) {
records = me.cleanRecords(node, records);
}
if (me.getParentIdProperty()) {
records = me.treeify(node, records);
}
if (isRootLoad) {
me.suspendEvent('add', 'update');
}
records = me.fillNode(node, records);
}
Ext.callback(options.onChildNodesAvailable, scope, args);
if (isRootLoad) {
me.resumeEvent('add', 'update');
me.callObservers('BeforePopulate');
me.fireEvent('datachanged', me);
me.fireEvent('refresh', me);
me.callObservers('AfterPopulate');
}
me.ItemTotal = operation.getResultSet().total;//获取数据总数
me.fireEvent('load', me, records, successful, operation, node);
}
2、在store中添加getTotalCount方法
store: {
getTotalCount: function () {
return this.Item || 0;
}
},