Can someone please help me with search bar for Kendo UI Panelbar.
- When search I want it display on type='program'. Example if I search account the programs that have account words should appear.
- Currently it not working at all. It just expand all my panelbar program. :(
Here i provide dojo demo
My javascript
function myFunction() {
var panelbar = $("#panelbar").data("kendoPanelBar");
panelbar.expand($("li", panelbar.element));
//panelbar.collapse($("li", panelbar.element));
var input, filter, ul, li, a, i, txtValue;
input = document.getElementById("myInput");
filter = input.value.toUpperCase();
ul = document.getElementById("panelbar");
li = ul.getElementsByTagName("li");
for (i = 0; i < li.length; i++) {
a = li[i].getElementsByTagName("li")[0];
txtValue = a.textContent || a.innerText;
if (txtValue.toUpperCase().indexOf(filter) > -1) {
li[i].style.display = "";
} else {
li[i].style.display = "none";
}
}
}
basically my nested list looks like this
<ul id="panelbar">
<input type="text" id="myInput" onkeyup="myFunction()" placeholder="Search...">
<li type="module">Agencies & Groups
<ul>
<li type="category">Agency & Booker
<ul>
<li type="program">Agency & Booker</li>
<li type="program">Region</li>
<li type="program">Sub Region</li>
</ul>
</li>
<li type="program">Agency Category</li>
<li type="program">Agency Contract</li>
<li type="program">Agency Overview</li>
</ul>
</li>
<li type="module">Call Charge & Billing
<ul>
<li type="category">JDS
<ul>
<li type="program">JDS Room Mapping</li>
<li type="program">JDS Room Status</li>
<li type="program">DS Interface</li>
</ul>
</li>
<li type="category">Operator Panel
<ul>
<li type="program">Wake Up Call</li>
<li type="program">Operator Panel</li>
</ul>
</li>
<li type="program">Call Code</li>
<li type="program">Charge Rate</li>
<li type="program">Property PABX</li>
<li type="program">Call Transaction</li>
</ul>
</li>
Here i provide dojo demo
Type
<LI>typeattribute is for bullet types. Place your types values (i.e. hierarchy level categorization values) in the class attribute. Changeto
An
idvalue should be unique among all the DOM elements (except maybe radio buttons). The leafs all have spans with the same id value,id="spanpanelbar". Place those in a class attribute as well. Changeto
The search match result processing is changing only the style
displayproperty of the leafs. Change the processing to add a class to the<li>, corresponding to the search result condition.See this dojo, an update of your original one. It has bonus code for:
The PanelBar widget is a hierarchical viewer. The items in the path to a program must be displayed in order to see the program. In order to display only paths to found programs you would:
Example:
dojo