noEditFormatter editable x-editable按需要动态设置可编辑
用x-editable的时候希望某些时候可以编辑某些条件下不可编辑有什么优雅的方式呢。网上说的比如动态设置可编辑太麻烦。参考下面这个BootStrapTable X-editable特定行可编辑的解决方案_bacoder的博客-CSDN博客其实这里用到的 noEditFormatter属性是wenzhixin的bootstrap table editable里的方法不是x-editable.js里的方法。用下面代码即可实现。$(#my_table_id).bootstrapTable({ noEditFormatter (value, row, index) { consle.log(value) if (value noEdit) { return No Edit } return false } })首先要引入script typetext/javascript src/static/js/bootstrap-editable.js/script script typetext/javascript src/static/js/bootstrap-table-editable.js/script比如isme和isadmin具有编辑权限则在页面用这样{ field: comment, title: 说明, halign: center, align: center, valign: middle, editable: { noEditFormatter (value, row, index) { // console.log(value) var bools{{.RoleUpdate}} if (!bools) { return value } return false }, type: text, pk: 1, url: /v1/mathcad/putmathcalinput, title: Enter MathComment },效果