bootstrap-table 行內編輯
阿新 • • 發佈:2017-09-27
根據 ext ots json fail defined www. edi .html
所需的樣式和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{ returnvalue; } }, 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‘); } }); }
bootstrap-table 行內編輯