Grid中有时候会统计所有子节点的值进行汇总时,store中只有query()方法,但有时会有问题,出现统计子节点出现计算错误:
var mixedCollection=s.queryExact("_parent",record.get("_id"));
这个时候就要重写store中原的的方法query了:
store中原有方法query为:
query : function(property, value, anyMatch, caseSensitive){
var fn = this.createFilterFn(property, value, anyMatch, caseSensitive);
return fn ? this.queryBy(fn) : this.data.clone();
},
重写query方法,改名后(queryExact --自定义)为:
Ext.override(Ext.data.Store,{
queryExact : function(property, value, anyMatch, caseSensitive){
var fn = this.createFilterFn(property, value, anyMatch, caseSensitive, true
);
return fn ? this.queryBy(fn) : this.data.clone();
}
});