简体   繁体   English

Kendo TabStrip Jquery无法正常工作

[英]Kendo TabStrip Jquery not working

So I am trying to dynamically add some content to a Kendo TabStrip through JavaScript. 因此,我试图通过JavaScript向Kendo TabStrip动态添加一些内容。 The code Im using to get the Jquery object is: 我用来获取Jquery对象的代码是:

$(document).ready(function () {

    $tabStrip = $("#tabStrip");
    alert(JSON.stringify($tabStrip));        
    $kendoTabStrip = $tabStrip.kendoTabStrip();
    alert(JSON.stringify($kendoTabStrip));
    $data = $kendoTabStrip.data("kendoTabStrip");
    alert(JSON.stringify($data));
});

This would synthetize to 这将综合为

$tabstrip=$('$tabStrip".kendoTabStrip().data("kendoTabStrip")

However, when I call an append method i get an error. 但是,当我调用append方法时,出现错误。 This is why I put the alert to know the value of the tabstrip and each time I am getting "undefined". 这就是为什么我发出警报以了解Tabstrip的值以及每次我得到“未定义”的原因。 I do not know what to do. 我不知道该怎么办。 I appreciate any help. 感谢您的帮助。

Greetings, Luis. 问候,路易斯。

In order to get a reference to the TabStrip normally you use: 为了获得对TabStrip的引用,通常使用:

$tabStrip = $("#tabStrip").data("kendoTabStrip");

you can also do: 您也可以:

$tabStrip = $("#tabStrip").kendoTabStrip().data("kendoTabStrip");

Doing this, you can call append for appending an additional tab. 为此,您可以调用append来附加其他选项卡。 Example: 例:

$tabStrip.append(
    [
        {
            text: "Baiona",
            content: "<h2>N/A</h2><p>Not available</p>"
        }
    ]
);

See it in action here : http://jsfiddle.net/OnaBai/5rgd7/ 在此处查看其运行情况: http : //jsfiddle.net/OnaBai/5rgd7/

NOTE: your $data is actually the reference to the TabStrip object so using your code you should do $data.append(...) . 注意: $data实际上是对TabStrip对象的引用,因此,使用代码应该执行$data.append(...)

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

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