Tree showItem & select issue

Hello, I’m hoping someone can point out what I’m doing wrong. I have a datatable and a tree. Selecting (double clicking) in the datatable causes the onItemDblClick:function() to be triggered which loops through the parent chain of folders (in the tree) opening them to the node that corresponds to the datatable selection — this all works as expected.
Unfortunately once the “path” to the node is opened in the tree I’m attempting to use these methods to bring the object into visibility and select it.

$$(“tree”).showItem(selected);
$$(“tree”).select(selected);

When the selection is made through this final call, the onSelectChange:function() is triggered and this is where the problem comes in. In the onSelectChange handler of the tree the call to this.getItem(id) is returning undefined. The id argument is correctly coming through and it all works perfectly when manually navigating the tree, but every time the selection is through the API as above it returns undefined.

Can anyone identify what I’m doing wrong? I’m using v3.3.13 btw.
Thanks -SrvrSide

Just to provide an update on this situation. The undefined return of the this.getItem(id) call is only returned on the first attempt. If the lack of response/action from the double click is ignored, subsequent efforts operate normally.
any thoughts on why the first iteration would return undefined??
Thanks - SrvrSide

Hello,

Could you please share the snippet that demonstrates this issue? From my side I can’t spot the error: http://webix.com/snippet/12367ecf.

Hello Helga,
Thanks for your reply. I have tried to create a simplified example on the URL http://webix.com/snippet/67fc1785
The datatable is populated through a search functionality so the node/container relationship is known and “recorded” in values not actually presented in the datatable (as in the sample). Double clicking on the datatable is meant to open the nested containers to the selected node, position that node such that it is visible in the tree and select that node.
I’m getting an exception thrown “webix_debug.js:13274 Uncaught TypeError: Cannot read property ‘$count’ of undefined”.
This appears to be triggered on $$(“tree”).open(container,true);
Any insight would me most welcome

webix.TreeAPI = {
open: function(id, show) {
if (!id) return;
//ignore open for leaf items
var item = this.getItem(id);
if (!item.$count || item.open) return; <------- [error thrown]

-SrvrSide

Sorry, but I still can’t reproduce the issue on your example. The error you get means that an item with the related id does not exist in tree.

Hello Helga, I think i may have found the problem and as expected it highlights my stupidity. The tree is “lazy loaded”, so only the “top” level is loaded initially. As the search results “know” of the container - node relationship I am attempting to work “up” the tree from the node’s parent container opening each to the root, before I select the node and make it visible. As the tree is loaded on demand the nested levels are not yet “in” the tree, so while the relationship is valid - it does not yet exist in the tree context.
I’m very sorry to have wasted your time, but thank you very much for your assistance
-SrvrSide