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