I have a tabbedView that has a tableView and a treeView as children. The requirement is to populate the treeView from a URL and then pick and display the highest two rows in the tableView. I do this by maintaining a TreeCollection.
- The treeCollection is which is copied to a DataCollection after completing loading.
- The DataCollection is then sorted descending and then truncated to keep the top two entries.
- Then I need to select the first row in the tableView.
Please see : https://snippet.webix.com/hs7jdx2b
This all works but is timing dependent. The snippet is simple but in my actual page if I keep refreshing the page, once in a while I get an error at line 25 which is
var firstId = tbl.getFirstId();
The error is getFirstId not found for undefined. It seems that data loading completed before the tableView was rendered. How do I assure that I can get rid of this sporadic issue ?