This is a migrated thread and some comments may be shown as answers.

Opening the First Item in a Panel

3 Answers 565 Views
PanelBar
This is a migrated thread and some comments may be shown as answers.
Joey
Top achievements
Rank 1
Joey asked on 06 Jun 2012, 11:23 PM
I'm using the Kendo UI Web v2012.1.515 version and had a need to expand the first item in a dynamically created PanelBar (in code behind via c#). To make it more complicated, I'm working in SharePoint 2010. After sniffing around the DOM for a bit, I found a class on the first item in the panel "k-first". Since accessing the PanelBar.expand() method requires a jQuery selector, I decided to use this class as my selector...
here's the code snippet...

//pass the PanelBar into a JavaScript Object...
var ScorecardList = $("ul[jqID|='ScorecardList']=").kendoPanelBar({ });

//Show the first Item in the DisplyOrder Option List...via the k-first class...
var FirstExpand = ScorecardList.data("kendoPanelBar").expand($(".k-first"));

Disclaimer...this worked for me. This might not work in future releases, and may not work as described here. Your mileage may vary.

3 Answers, 1 is accepted

Sort by
0
Kamen Bundev
Telerik team
answered on 07 Jun 2012, 06:55 AM
Hi Joey,

You can also omit the $() or use expand("> li:first") as a selector (to be sure it is the first descendant of the PanelBar root).

Also, please note that expand() will return the PanelBar object, not the item.

Regards,
Kamen Bundev
the Telerik team
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
0
eliraz
Top achievements
Rank 1
answered on 19 Jun 2013, 07:52 PM
and how can i select the son item for the first root item?
0
Alexander Valchev
Telerik team
answered on 25 Jun 2013, 06:51 AM
Hello eliraz,

You can use:
$("#panelbar").data("kendoPanelBar")
    .expand(">li:first") //expand root
    .select(">li:first >.k-group >li:first"); //select the first son

I hope this will help.

Regards,
Alexander Valchev
Telerik
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
Tags
PanelBar
Asked by
Joey
Top achievements
Rank 1
Answers by
Kamen Bundev
Telerik team
eliraz
Top achievements
Rank 1
Alexander Valchev
Telerik team
Share this question
or