【问题标题】:Kendo Tabstrip tab with close button带有关闭按钮的 Kendo Tabstrip 选项卡
【发布时间】:2015-07-01 09:18:10
【问题描述】:

我有一个带有关闭按钮的剑道标签。问题是我无法让按钮单击事件来关闭该选项卡。

 @(Html.Kendo().TabStrip()
  .Name("test")
  .Items(tabstrip =>
  {
     tabstrip.Add().Text("")
     .Selected(true)
     .ContentHtmlAttributes(new { style = "overflow: auto;" })
     .Content("");
  })
  .SelectedIndex(0)
  )

<script>
  tab.append({
    text: "" + name + " <input type='button' id='ddddd'>X</input> ",
    contentUrl: content,
    encoded: false
    //imageUrl: "/Images/close.png" <span class='tabdelete k-button'><span class=' k-icon k-i-close' ></span></span>
   })

 $("#ddddd").click(function () {
    alert("done");
 });
</script>

【问题讨论】:

  • 添加点击事件监听的代码在哪里?恐怕没有足够的信息来帮助你……
  • 事件处理程序在哪里
  • 添加了检查处理程序!...
  • 编辑了我的问题,可以吗?
  • 这里我从一个按钮点击附加标签,每个标签都需要关闭按钮,请帮帮我

标签: c# asp.net-mvc razor kendo-ui kendo-tabstrip


【解决方案1】:

你的需求看起来像this吗? http://jsfiddle.net/palanikumar/8jf2wpng/

$('.cls-btn').click(function()
{
    var index = $(this).parent().parent().index();
    var tabStrip = $('#tabstrip').getKendoTabStrip();
    tabStrip.remove(index);
    tabStrip.select(0);
});

【讨论】:

    【解决方案2】:

    试试这个

    <input type='button' class="button" id='ddddd'>X</input>
    
    
       <script type="text/javascript">
            $(function(){
                 //replace your selector if u need ID
                  //$('body').on('click', '#buttonID', function () {
                $('body').on('click', '.button', function () {
    
                    alert('ddsda');
                });
            });
            </script>
    

    【讨论】:

    • 非常感谢 Jagadeesh。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2021-06-09
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多