Version : jstree-3.3.16-0-gb3135cf
I used regexp in search callback and its working if the user input ^ in the field
search_callback : function (str, node) { try { return node.data.fullname.match(new RegExp(str)); } catch(ex) { return false; } },
I have a checkbox for using regex (word start with) so I can add ^ in the begging of the search word
If checked the function will add ^ in the begging of the search word
I tried several methods but it didn't not work, the last one works if the box is unchecked the checked, but when unchecking it doesn’t work
The code
$(function () {
$('#search_word').keyup(function(){
$('#ajax').jstree(true).show_all();
var value = $(this).val();
if($("#search_start_with").is(':checked')){
value = '^'+value ;
}
$('#search_start_with').change(function() {
if($(this).is(":checked")) {
value = '^'+value ;
$("#ajax").jstree("search",value);
return;
}
});
$("#ajax").jstree("search", value);
});
});
Can this be solved if the box checked then add ^ else use the search word without it?
I am afraid this is not exactly related to jstree - your trouble is with the order of events and checks in your own code. Unfortunately I can not give you a solution for that.
Version : jstree-3.3.16-0-gb3135cf I used regexp in search callback and its working if the user input ^ in the field
search_callback : function (str, node) { try { return node.data.fullname.match(new RegExp(str)); } catch(ex) { return false; } },
I have a checkbox for using regex (word start with) so I can add ^ in the begging of the search word
If checked the function will add ^ in the begging of the search word I tried several methods but it didn't not work, the last one works if the box is unchecked the checked, but when unchecking it doesn’t work
The code
Can this be solved if the box checked then add ^ else use the search word without it?