bootstrap- X-editable 行内编辑
前面不要忘记引入'editable'
{field: 'weigh', title: __('Weigh'),editable: {type: 'text',url: "api/cat/editWeigh",validate: function (v) {if($.trim(v) == '') return '值不能为空';if(!$.isNumeric(v)) return '值只能为数字';if(v<0 || v%1!==0) return '值必需为正整数';},success: function(response, newValue) {console.log("====ok=====",response, newValue);let that = this;setTimeout(function(){$(that).editable('hide');},1000);//$(that).html(newValue); //更新页面上的显示值//更新内存对象值,如果该字段是排序字段,页面会重新排序table.bootstrapTable('updateCell', {index: $(that).closest("tr").data('index'), //行索引field: 'weigh', //列名value: newValue //cell值});return response.msg; //不返回值会两次提交,目前不知道为什么},error: function(response, newValue){console.log("====error=====",response, newValue);return "请求失败";}}
}