javascriptasp.net-mvckendo-uikendo-panelbar

Count Panels (items) in a Kendo PanelBar


I use the JavaScript code below to insert items, how can I count how many there are?

 <script type="text/javascript">
            function OnClickAdd() {
                $("#panelbar").kendoPanelBar();
                var panelBar = $("#panelbar").data("kendoPanelBar");
                    panelBar.append(
                    {
                        text: "New Person",
                        encoded: false,
                        content: "New Person"
                    }
                  )
            }
        </script>

Solution

  • $("#panelbar").kendoPanelBar().data("kendoPanelBar").element.children("li").length
    

    Found code similar to this in Kendo PanelBar API sample: http://demos.telerik.com/kendo-ui/panelbar/api