Browse Source

Merge pull request #4288 from wenzhixin/fix/4072

Fix issue 4072
文翼 6 years ago
parent
commit
e361854103
2 changed files with 7 additions and 1 deletions
  1. 6 0
      site/docs/api/column-options.md
  2. 1 1
      src/bootstrap-table.js

+ 6 - 0
site/docs/api/column-options.md

@@ -180,6 +180,9 @@ The column options is defined in `jQuery.fn.bootstrapTable.columnDefaults`.
 - **Detail:**
 
   Set `true` to show a radio. The radio column has fixed width.
+  
+  If a value is given the Checkbox is automatically checked.  
+  Its also possible to check/uncheck the radio by use an formatter (return `true` to check, return `false` to uncheck).
 
 - **Default:** `false`
 
@@ -192,6 +195,9 @@ The column options is defined in `jQuery.fn.bootstrapTable.columnDefaults`.
 - **Detail:**
 
   Set `true` to show a checkbox. The checkbox column has fixed width.
+  
+  If a value is given the Checkbox is automatically checked.  
+  Its also possible to check/uncheck the checkbox by use an formatter (return `true` to check, return `false` to uncheck). 
 
 - **Default:** `false`
 

+ 1 - 1
src/bootstrap-table.js

@@ -1293,7 +1293,7 @@ class BootstrapTable {
         type = column.radio ? 'radio' : type
 
         const c = column['class'] || ''
-        const isChecked = value === true || (value_ || (value && value.checked))
+        const isChecked = (value === true || value_ || (value && value.checked)) && value !== false
         const isDisabled = !column.checkboxEnabled || (value && value.disabled)
 
         text = [