1
我正在嘗試開發一種自定義搜索方法,只在父項目之間進行搜索,並顯示樹結構的子項目。然而,根據我所做的測試,我發現這種方法沒有被觸發,並且仍然使用默認搜索方法。我期待着您的幫助。jstree自定義搜索方法不起作用
謝謝。
$(function() {
$.expr[':'].jstree_parent_search = function(a, i, m) {
console.log(a);
};
$(".jstree").jstree({
'core': {
'data': GetAllPages(),
'check_callback': true,
'themes': {
"icons": false
}
},
'search': {
'search_method': 'jstree_parent_search'
},
'plugins': ['checkbox', 'search']
});
var po = false;
$('#txtSearch').keyup(function() {
if (po) { clearTimeout(po); }
po = setTimeout(function() {
var v = $('#txtSearch').val();
$('.jstree').jstree(true).search(v);
}, 250);
});
});