Closed bhatsandeep closed 4 years ago
I will need to see your full config, but this must be something you have configured, as jstree defaults to only searching in the text content of the node. Please share your config so that I can help.
Sharing the details as below:
$(c_tree).jstree({ "core" : { "animation" : 0, "multiple" : false, "check_callback" : true, "themes" : { "stripes" : true }, "data" : eval(jsondata) }, "plugins" : [ "changed", "contextmenu", "dnd", "search", "state", "types", "wholerow" ], "search": { "case_sensitive": false, "show_only_matches": true }, "types" : { "#" : { "max_children" : 1, "max_depth" : 6, "valid_children" : ["root"] }, "root" : { "icon" : "/img/folder.svg", "valid_children" : ["default"] }, "default" : { "icon" : "/img/folder.svg", "valid_children" : ["default"] } } });
jsondata = [{'id': '1', 'parent': '#', 'text': 'schedule', 'data': {}}, {'id': '2', 'parent': '1', 'text': 'ide-init', 'data': {'1': {'key': 'function', 'value': '_init'}, '2': {'key': 'startup', 'value': True}}}, {'id': '3', 'parent': '#', 'text': 'variables', 'data': {'1': {'key': 'IDE_GOOGLE_AUTH_KEY', 'value': '12342342343124234'}, '2': {'key': 'IDE_GOOGLE_AUTH_SECRET', 'value': '7vn5YXvpncpeweijkerj34-'}}}]
Seems to work just fine: https://jsfiddle.net/dr0atzqw/1/
Sorry for the delayed response. I found the issue was with my data at another place.
Appreciate your help.
if the data contains values like {"somedata": true} it throws an error "Uncaught TypeError: a.toLowerCase is not a function" if we try to perform search on the tree
search = function (text) { text = options.caseSensitive ? text : text.toLowerCase();
should be something like
search = function (text) { text = options.caseSensitive ? text : (text.toString()).toLowerCase();