I am testing my UI behavior and I am trying to click on a jstree node programmatically:
$('#search_jstree_id')
.jstree(true)
.select_node('nodeName');
But the nodeName
comes from users search and it is not exact match with the existing nodes, so I want to use a regular expression in .select_node
. I can not make it work. Is it possible? Any other way for jstree?
Not really a regular expression, but you can use a CSS selector, like:
.select_code('.jstree-node[id*="' + selector + '"]')
...where selector
is the user input. It will match nodes which have an id
that contains the provided string. So for example if selector = 'can'
then it could match nodes candle
and scanned
, but not clan
.