浏览代码

Added noeditFormatter editable function support

zhixin 5 年之前
父节点
当前提交
32f425059f
共有 2 个文件被更改,包括 7 次插入4 次删除
  1. 2 2
      site/docs/extensions/editable.md
  2. 5 2
      src/extensions/editable/bootstrap-table-editable.js

+ 2 - 2
site/docs/extensions/editable.md

@@ -37,7 +37,7 @@ Use Plugin: [x-editable](https://github.com/vitalets/x-editable)
 - **type:** `Boolean`
 
 - **Detail:**
-    
+
     Set `true` to use always the formatter, even if the column was already edited.
 
 - **Default:** `false`
@@ -80,7 +80,7 @@ Use Plugin: [x-editable](https://github.com/vitalets/x-editable)
     editable: {
       noeditFormatter (value, row, index) {
         if (value === 'noedit') {
-          return true
+          return 'No Edit'
         }
         return false
       }

+ 5 - 2
src/extensions/editable/bootstrap-table-editable.js

@@ -78,8 +78,11 @@ $.BootstrapTable = class extends $.BootstrapTable {
         })
 
         let _dont_edit_formatter = false
-        if (column.editable.hasOwnProperty('noeditFormatter')) {
-          _dont_edit_formatter = column.editable.noeditFormatter(value, row, index)
+        const editableOpts = Utils.calculateObjectValue(column,
+          column.editable, [index, row], {})
+
+        if (editableOpts.hasOwnProperty('noeditFormatter')) {
+          _dont_edit_formatter = editableOpts.noeditFormatter(value, row, index)
         }
 
         if (_dont_edit_formatter === false) {