是否有任何方法可以在按钮单击时将项目添加到kendo面板栏?

时间:2015-01-08 05:59:09

标签: kendo-ui kendo-panelbar

我正在开发一个应用,我需要在按钮点击时将项目添加到kendo面板栏。 这些面板需要可扩展/可折叠。 有没有办法做到这一点?

1 个答案:

答案 0 :(得分:0)

<ul id="panelbar"></ul>
<script>
    $("#panelbar").kendoPanelBar();

    var panelBar = $("#panelbar").data("kendoPanelBar");
    panelBar.append(
        [
            {
                text: "Item 1",
                cssClass: "myClass",                            // Add custom CSS class to the item, optional, added 2012 Q3 SP1.
                url: "http://www.telerik.com/"                  // link URL if navigation is needed, optional.
            },
            {
                text: "<b>Item 2</b>",
                encoded: false,                                 // Allows use of HTML for item text
                content: "text"                                 // content within an item
            },
            {
                text: "Item 3",
                contentUrl: "http://demos.telerik.com/kendo-ui/content/web/panelbar/ajax/ajaxContent1.html"
            },
            {
                text: "Item 4",
                imageUrl: "http://demos.telerik.com/kendo-ui/content/shared/icons/sports/baseball.png",
                expanded: true,                                 // item is rendered expanded
                items: [{                                       // Sub item collection.
                    text: "Sub Item 1"
                },
                {
                    text: "Sub Item 2"
                }]
            },
            {
                text: "Item 5",
                // item image sprite CSS class, optional
                spriteCssClass: "imageClass3"
            }
        ]
    );
</script>

参考:http://docs.telerik.com/kendo-ui/api/javascript/ui/panelbar#methods-append