lihuanliu

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

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

 

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

{
    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\');
        }
    });
}

 

分类:

技术点:

相关文章: