Note that there are some explanatory texts on larger screens.

plurals
  1. POJQuery Dynatree - How to search node with level delimiter?
    text
    copied!<p>I need to use a searching function for my dynatree and so I found this workaround: <a href="https://stackoverflow.com/questions/12277797/jquery-dynatree-search-node-by-name">JQuery Dynatree - search node by name</a></p> <p>However, I need to have it search only up until my expanded node delimiter. (I am using jQuery ui-slider to dynamically set the expand delimiter). Initially, I need it to search until my minExpandedLevel. And if I move the slider, the dynatree should show <strong>only matching results</strong> in expanded level equivalent to the slider value.</p> <p>Trying to reset the minExpandLevel and reloading the dynatree just wont do as it returns all(even non-matching) nodes as result.</p> <p>So I want to add a limit parameter to the search function like:</p> <blockquote> <p>$(selector).dynatree("getRoot").search(pattern, limit);</p> </blockquote> <p>Does anybody know how to do this?</p> <p>Here's my code:</p> <p><strong>dynatree:</strong></p> <pre><code>$.ui.dynatree.nodedatadefaults["icon"] = false; $("#resultTree").dynatree({ minExpandLevel: 4, persist: false, classNames: { vline: "no-bg", connector: "", expander: "ui-helper-hidden" }, children: myJsonData }); </code></pre> <p><strong>slider:</strong></p> <pre><code>timeout = false; searchTerm = $("#searchText").val(); $("#treeslider").slider({ min: minTick, max: maxTick, range: "min", slide: function (event, ui) { if (timeout) { clearTimeout(timeout); } timeout = setTimeout(function () { $("#resultTree").dynatree("getRoot").search(searchTerm, ui.value); }, 500); } }); </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload