source: [view]
if(queryObj){
var start = queryObj.start || 0,
count = queryObj.count,
parentId = queryObj.parentId,
sort = queryObj.sort;
if(parentItem === this.root){
this.root.size = 0;
this.store.fetch({
start: start,
count: count,
sort: sort,
query: this.query,
onBegin: dojo.hitch(this, function(size){
this.root.size = size;
}),
onComplete: dojo.hitch(this, function(items){
onComplete(items, queryObj, this.root.size);
}),
onError: onError
});
}else{
var store = this.store;
if(!store.isItemLoaded(parentItem)){
var getChildren = dojo.hitch(this, arguments.callee);
store.loadItem({
item: parentItem,
onItem: function(parentItem){
getChildren(parentItem, onComplete, onError, queryObj);
},
onError: onError
});
return;
}
if(this.serverStore && !this._isChildrenLoaded(parentItem)){
this.childrenSize = 0;
this.store.fetch({
start: start,
count: count,
sort: sort,
query: dojo.mixin({parentId: parentId}, this.query || {}),
onBegin: dojo.hitch(this, function(size){
this.childrenSize = size;
}),
onComplete: dojo.hitch(this, function(items){
onComplete(items, queryObj, this.childrenSize);
}),
onError: onError
});
}else{
this.inherited(arguments);
}
}
}else{
this.inherited(arguments);
}