Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

is there a way to collapse all the panels of Kendo Panelbar, on an action?

I am working on an app where i am adding panelbars (multiselection) using JSP Wrapper (which means no ID to each of the panels), and inside those have the grids.

The grids are storing data specific to the selected person, who are displayed as list items(images) on the top of the page.

What I want to do is that when user changes the selection of person, from the current selected to another, collapse all the panels of the kendo panelbar. This would help in reloading the data of the new person, because when the user will select/expand the panel to see the data, i would catch the event and reload the grid with a new Datasource, based on the selected person.

I hope I make sense here, but I am not sure how to collapse all the panels of the PanelBar.

Any Suggestions??

like image 821
nick Avatar asked May 09 '13 21:05

nick


2 Answers

If the id of your PanelBar is panel, do:

$("#panel").data("kendoPanelBar").collapse($("li", "#panelbar"));

or

var panelbar = $("#panelbar").data("kendoPanelBar");
panelbar.collapse($("li", panelbar.element));

i.e. we will collapse every li element under #panelbar.

EDIT: If you want to remove the selection, add:

$(".k-state-selected", panelbar.element).removeClass("k-state-selected");
like image 166
OnaBai Avatar answered Oct 11 '22 15:10

OnaBai


HTML

  <ul id="palettePanelBar">
            <li id="item1" class="k-state-active">
               <!--Some Data-->
            </li>
            <li id="item2">
               <!--Some Data for second item-->

            </li>
 </ul>

Javascript

 var panelBar = $("#palettePanelBar").data("kendoPanelBar");
    panelBar.expand($('[id^="item"]'));
like image 25
maxspan Avatar answered Oct 11 '22 16:10

maxspan