bootstrap-table 行內編輯


所需的樣式和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');
        }
    });
}

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM