简体   繁体   English

是否可以在Kendo Panelbar标题上添加Kendo菜单?

[英]Is it possible to add Kendo Menu on Kendo Panelbar header?

Can someone help us. 有人可以帮助我们。 Our client wants to have a kendo menu on the header of the kendo panelbar next to the "Remarks". 我们的客户希望在“备注”旁边的剑道面板栏的标题上有一个剑道菜单。 how can we achieve this ? 我们怎样才能做到这一点? Thank you so much! 非常感谢!

Below is our code: 以下是我们的代码:

 @(Html.Kendo().PanelBar()
        .Name("AnnotationRemarks")
        .HtmlAttributes(new { @class = "pnlAnnotationRemarks" })
        .Items(items =>
        {
            items.Add()
                .Text("Instructions")
                .HtmlAttributes(new { @class = "annotationPanelHeader" })
                .Content(@<text> @(InstructionsList()) </text>);
            items.Add()
                .Text("Remarks")
                .HtmlAttributes(new { @class = "annotationPanelHeader" })
                .Content(@<text> @(RemarksList()) </text>

                );
        })
        .ExpandMode(PanelBarExpandMode.Multiple)
        .Events(e =>
        {
            e.Expand("OnPanelExpand");
            e.Collapse("OnPanelCollapsed");
        })
        .Animation(a =>
        {
            a.Collapse(c => c.Duration(0));
            a.Expand(e => e.Duration(0));
        })
    )

Try the following: 请尝试以下方法:

@(Html.Kendo().PanelBar()
    .Name("AnnotationRemarks")
    .HtmlAttributes(new { @class = "pnlAnnotationRemarks" })
    .Items(items =>
    {
        items.Add()
            .Text("Instructions")
            .HtmlAttributes(new { @class = "annotationPanelHeader" })
            .Content(@<text> @(InstructionsList()) </text>);
        items.Add()
            .Text("Remarks")
            .HtmlAttributes(new { @class = "annotationPanelHeader" })
            .Content(@<text> @(RemarksList()) </text>);
        items.Add()
       .Text("Menu")
       .HtmlAttributes(new { @id = "annotationPanelHeaderMenu" })
    })
    .ExpandMode(PanelBarExpandMode.Multiple)
    .Events(e =>
    {
        e.Expand("OnPanelExpand");
        e.Collapse("OnPanelCollapsed");
    })
    .Animation(a =>
    {
        a.Collapse(c => c.Duration(0));
        a.Expand(e => e.Duration(0));
    }))

And the jQuery part: 和jQuery部分:

$(document).ready(function () {
    $("#annotationPanelHeaderMenu").html('<ul id="menuExample"><li>Test1</li><li>Test2</li><li>Test3</li></ul>')
    $("#menuExample").kendoMenu();
});

As far i know there is no solution for pure mvc wrappers. 据我所知,纯mvc包装器没有解决方案。

It is impossible to achiev this in pure mvc component. 在纯mvc组件中实现这一点是不可能的。 The closest thing I can imagine would be put kendoTabstrip or kendoMenu inside of kendoPanelBar template and keep "Remarks" header. 我能想象的最接近的事情是将kendoTabstrip或kendoMenu放在kendoPanelBar模板中并保留“备注”标题。

On the other hand it is possible to implement it in jQuery. 另一方面,可以在jQuery中实现它。 Simple after rendering of the kendoPanelBar you would need to find header element and change it on content or widget you want. 渲染kendoPanelBar后,您需要找到标题元素并在所需的内容或小部件上进行更改。

EDIT: 编辑:

Here is example with panelbar build in javascript from <ul>...</ul> template: http://dojo.telerik.com/Ozisu 以下是来自<ul> ... </ ul>模板的javascript中使用panelbar构建的示例: http ://dojo.telerik.com/Ozisu

It just simply puts menu structure in panelbar header and uses: 它只是简单地将菜单结构放在panelbar标题中并使用:

$(document).ready(function() {
    $("#menu").kendoMenu();
});

to create menu from it. 从中创建菜单。

For keep panelbar in MVC use html() method to paste menu structure into header like Przemysław Kleszcz said in his answer. 为了保持MVC中的panelbar,使用html()方法将菜单结构粘贴到标题中,就像PrzemysławKleszcz在他的回答中所说的那样。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM