账号密码登录
微信安全登录
微信扫描二维码登录

登录后绑定QQ、微信即可实现信息互通

手机验证码登录
找回密码返回
邮箱找回 手机找回
注册账号返回
其他登录方式
分享
  • 收藏
    X
    一个按钮实现插入/删除的功能
    27
    0

    用bootstrap table生成一列都为操作的按钮,当我点击这个按钮的时候在当前行的下面一行插入一行内容,再点击这个按钮的时候将插入的这一行删除,试了好久都不能实现。下面是我最后只能实现一次的效果,再点击就没有反应了。
    window.operateEvents = {

        "click #TableEditor": function () {
           $(this).unbind('click');
                 var html = '';
        html += '<tr><td colspan="4">';
    
    
                html += '<p><b>来电原因:</b>aaa</p>';
    
    
        html += '</td></tr>';
        $(this).parent().parent().after(html);
    
      //  setTimeout(function () {
           // $(this).parent().parent().next().addClass('hide').toggle()
      //  },100)
        //$(this).parent().parent().next().addClass('hide').toggle()
        $(this).click(function () {
            $(this).parent().parent().next().addClass('hide').toggle()
        })
            //  $(this).parent().parent().next().toggle()
       
        }
    }
    $('table').bootstrapTable({
        url: "getsu",
        columns: [{
            field: "Age",
            title:"年龄"
        }, {
                field: "City",
                title: "城市"
            }, {
                field: "Name",
                title: "姓名",
                events: operateEvents,
                formatter: AddFunctionAlty
            }]
    })
    function AddFunctionAlty(val) {
        return "<a  id='TableEditor'>" + val + "</a>"
    }
    0
    打赏
    收藏
    点击回答
        全部回答
    • 0
    更多回答
    扫一扫访问手机版
    • 回到顶部
    • 回到顶部