Browse Source

Allow disabling of checkboxes

This allows use of the disabled property of HTML checkboxes.
Janet Moery 11 years ago
parent
commit
1148c4392c
1 changed files with 4 additions and 1 deletions
  1. 4 1
      src/bootstrap-table.js

+ 4 - 1
src/bootstrap-table.js

@@ -144,6 +144,7 @@
     BootstrapTable.COLUMN_DEFAULTS = {
         radio: false,
         checkbox: false,
+        checkboxEnabled: true,
         field: undefined,
         title: undefined,
         'class': undefined,
@@ -774,7 +775,9 @@
                             sprintf(' name="%s"', that.options.selectItemName) +
                             sprintf(' type="%s"', type) +
                             sprintf(' value="%s"', item[that.options.idField]) +
-                            sprintf(' checked="%s"', value ? 'checked' : undefined) + ' />',
+                            sprintf(' checked="%s"', value ? 'checked' : undefined) +
+                            sprintf(' %s', that.options.columns[j].checkboxEnabled ? undefined : 'disabled') +
+                            ' />',
                         '</td>'].join('');
                 } else {
                     value = typeof value === 'undefined' ? that.options.undefinedText : value;