Browse Source

Fix #30: Radiobutton fix on artifical click event trigger.

zhixin 11 years ago
parent
commit
1e64038279
1 changed files with 2 additions and 4 deletions
  1. 2 4
      src/bootstrap-table.js

+ 2 - 4
src/bootstrap-table.js

@@ -202,9 +202,6 @@
         });
         });
         this.options.columns = $.extend(true, columns, this.options.columns);
         this.options.columns = $.extend(true, columns, this.options.columns);
         $.each(this.options.columns, function(i, column) {
         $.each(this.options.columns, function(i, column) {
-            if (i === 0 && column.radio) {
-                that.options.singleSelect = true;
-            }
             that.options.columns[i] = $.extend({}, BootstrapTable.COLUMN_DEFAULTS, column);
             that.options.columns[i] = $.extend({}, BootstrapTable.COLUMN_DEFAULTS, column);
         });
         });
 
 
@@ -253,6 +250,7 @@
             if (column.radio) {
             if (column.radio) {
                 text = '';
                 text = '';
                 that.header.stateField = column.field;
                 that.header.stateField = column.field;
+                that.options.singleSelect = true;
             }
             }
 
 
             html.push(text);
             html.push(text);
@@ -715,7 +713,7 @@
         this.$selectItem.off('click').on('click', function(event) {
         this.$selectItem.off('click').on('click', function(event) {
             event.stopImmediatePropagation();
             event.stopImmediatePropagation();
             var checkAll = that.$selectItem.length === that.$selectItem.filter(':checked').length,
             var checkAll = that.$selectItem.length === that.$selectItem.filter(':checked').length,
-                checked = $(this).prop('checked'),
+                checked = $(this).prop('checked') || $(this).is(':radio'),
                 row = that.data[$(this).data('index')];
                 row = that.data[$(this).data('index')];
 
 
             that.$selectAll.prop('checked', checkAll);
             that.$selectAll.prop('checked', checkAll);