我有一個包含文件夾對象列表的標準jstree。用戶能夠對文件夾的名稱進行基本搜索,並且我想要隱藏與搜索不匹配的所有文件夾。一切工作正常,直到我需要實際隱藏不匹配的節點的部分。隱藏JSTree中的特定節點
//Iterate through all elements of the tree.
var xmlString = $("#standardTree").jstree("get_xml");
var xmlDOM = $.parseXML(xmlString);
var items = $(xmlDOM).find("root item");
$.each(items, function (key, item) {
//If a node's text doesn't match the search, hide that node.
if ($(item).text() != result.searchString) {
//**Not sure what to do here, this doesn't work.**
$(item).hide();
}
});
使用$(本).hide代替。 –
在這種情況下,我可能是錯的,但不是$(this).hide()與$(item).hide()完全相同嗎? – Blankdud