I’m populating a DBTreeView and found that both of the following pieces of code seem to function exactly the same. Which is the better (preferred) method to use and why? Is one faster than the other etc.?
//Populate the tree - Method one
var _fs=controller.find();
controller.search(true,true);
_jsTree.addRoots(foundset);
OR
//Populate the tree - Method two
var _fs = databaseManager.getFoundSet(controller.getDataSource());
_fs.loadRecords();
_jsTree.addRoots(_fs);
When you go to find mode and do a search without specifying parameters, it does the same query as in your second option, but there will be some overhead. Especially since you use the foundset that is shown on your form, it will do a lot of unnecessary UI stuff when going to find mode and back.