简体   繁体   English

如何将交叉关闭按钮添加到动态生成的剑道标签

[英]How to add Cross close button to a dynamic generated kendo tabstrip

I am currently able to create kendo tab dynamically and have external button to remove the tab. 我目前能够动态创建剑道选项卡,并具有外部按钮来删除选项卡。 Here is my sample code 这是我的示例代码

// Create Main Tab
        tabStrip = $("#tabstrip").kendoTabStrip({
            animation: {
                open: {
                    effects: "fadeIn"
                }
            }
        });
        tabStrip = $("#tabstrip").data("kendoTabStrip");
        tabStrip.select(0);

To create new tab 创建新标签

tabStrip.append({ text: "My Title", content: "the content" }); 
//OR 
tabStrip.append({ text: "My Title", contentURL: "http://google.com" });

For remove i have separate button with code 为了删除我有代码的单独按钮

var tab = tabStrip.select(),
tabStrip.remove(tab);

It removes the selected tab. 它删除选定的选项卡。 Its Working fine. 它的工作正常。 But my requirement is to add this remove button with caption. 但是我的要求是添加带有标题的此删除按钮。

if i have button tag in caption while creating tabstrip then it converts the tag in to a DOM object. 如果在创建Tabstrip时标题中有按钮标签,则它将标签转换为DOM对象。 for example 例如

<ul id="tabstrip">
    <li> Title <button>X</button></li>
</ul>

if now kendo tab strip is created is will show a button having "X" caption in the title of tab. 如果现在创建了剑道标签栏,则会在标签标题中显示一个带有“ X”标题的按钮。 but not if i provide same title while creating the tab at run time in the append method. 但是如果我在append方法中在运行时创建选项卡时提供了相同的标题,则不会。

The appended text is encoded, and this is why you see the string, but not the HTML element itself. 附加的文本已编码,这就是为什么您看到字符串而不是HTML元素本身的原因。 What you can do is after you append the TabStrip element, you can append a button using jQuery, like this: 您可以做的是在附加TabStrip元素之后,可以使用jQuery附加按钮,如下所示:

http://dojo.telerik.com/ArIyO http://dojo.telerik.com/ArIyO

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

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