Skip to content

Instantly share code, notes, and snippets.

Created July 11, 2015 15:35
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save anonymous/f4780ccde614a46ef87d to your computer and use it in GitHub Desktop.
Save anonymous/f4780ccde614a46ef87d to your computer and use it in GitHub Desktop.
SugarCRM :: Sidecar :: get records collection recursive function
({
getRecordsRecursive: function(moduleName, filters, offset, collectionBuffer, callback){
if(offset > -1){
var collection = App.data.createBeanCollection(moduleName);
var req = collection.fetch({"filter": filters, "offset": offset});
req.xhr.success(function(data){
if(data.records){
collectionBuffer.add(data.records);
getRecordsRecursive(moduleName, filters, data.offset, collectionBuffer, callback);
}
});
}
else{
callback(collectionBuffer);
}
}
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment