Browse Source

Fix #1021: click to select bug.

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

+ 4 - 2
src/bootstrap-table.js

@@ -1474,8 +1474,10 @@
             // if click to select - then trigger the checkbox/radio click
             if (e.type === 'click' && that.options.clickToSelect) {
                 if (that.header.clickToSelects[$tr.children().index($(this))]) {
-                    $tr.find(sprintf('[name="%s"]',
-                        that.options.selectItemName))[0].click(); // #144: .trigger('click') bug
+                    var $selectItem = $tr.find(sprintf('[name="%s"]', that.options.selectItemName));
+                    if ($selectItem.length) {
+                        $selectItem[0].click(); // #144: .trigger('click') bug
+                    }
                 }
             }
         });