Created
July 11, 2015 15:35
-
-
Save anonymous/f4780ccde614a46ef87d to your computer and use it in GitHub Desktop.
SugarCRM :: Sidecar :: get records collection recursive function
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
({ | |
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