bootstrap-table 行内编辑

所需的样式和js文件: https://pan.baidu.com/s/1eSAKzyM 密码: s3whhtml

参考 : http://www.cnblogs.com/landeanfen/p/5005367.htmlajax

 

columnsDefined()  处须要加行内编辑的可这么设置bootstrap

{
    title : '备注',
    field : 'remark',
    formatter : function(value, row, index){
        if(value == null){
            return "添加";
        }else{
            return value;
        }
    },
    editable:{
        title : '添加备注',
        type  : "text"
    }
},

 

onEditableSave的设置
onEditableSave: function (field, row, oldValue, $el) {
    $.ajax({
        type: "POST",
        url: home + editUrl,(此处根据本身项目的配置填,反正就是目标请求url)
        data:{"param" : JSON.stringify(row)},
        success: function (data, status) {
            if (data == "success") {
                swal("修改为功");
            }else if(data == "failure"){
                swal("修改失败");
            }else{
                $("#bootstrapTable").bootstrapTable('refresh');
                swal("修改失败");
            }
        },
        error: function () {
            $("#bootstrapTable").bootstrapTable('refresh');
            swal("修改失败");
        },
        complete: function () {
//            $("#bootstrapTable").bootstrapTable('refresh');
        }
    });
}