ソースを参照

Fix some errors

zhixin 9 年 前
コミット
ce3e0e1c6d

+ 3 - 3
docs/_i18n/en/documentation/column-options.md

@@ -53,7 +53,7 @@ The column options is defined in `jQuery.fn.bootstrapTable.columnDefaults`.
         <td>data-title-tooltip</td>
         <td>String</td>
         <td>undefined</td>
-        <td>The column title tooltip text. This option also support the title HTML attribute</td>
+        <td>The column title tooltip text. This option also support the title HTML attribute.</td>
     </tr>
     <tr>
         <td>class</td>
@@ -152,7 +152,7 @@ The column options is defined in `jQuery.fn.bootstrapTable.columnDefaults`.
         <td>data-click-to-select</td>
         <td>Boolean</td>
         <td>true</td>
-        <td>True to select checkbox or radiobox when the column is clicked.</td>
+        <td>True to select checkbox or radio when the column is clicked.</td>
     </tr>
     <tr>
         <td>formatter</td>
@@ -183,7 +183,7 @@ The column options is defined in `jQuery.fn.bootstrapTable.columnDefaults`.
         <td>Object</td>
         <td>undefined</td>
         <td>
-        The cell events listener when you use formatter function, take three parameters: <br>
+        The cell events listener when you use formatter function, take four parameters: <br>
         event: the jQuery event. <br>
         value: the field value. <br>
         row: the row record data.<br>

+ 9 - 8
docs/_i18n/en/documentation/table-options.md

@@ -60,7 +60,7 @@ The table options are defined in `jQuery.fn.bootstrapTable.defaults`.
         <td>data-sort-name</td>
         <td>String</td>
         <td>undefined</td>
-        <td>Defines which column can be sorted.</td>
+        <td>Defines which column will be sorted.</td>
     </tr>
     <tr>
         <td>sortOrder</td>
@@ -89,6 +89,7 @@ The table options are defined in `jQuery.fn.bootstrapTable.defaults`.
         <td>String</td>
         <td>undefined</td>
         <td>Defines icon size: <ul><li>undefined => btn</li><li>xs => btn-xs</li><li>sm => btn-sm</li><li>lg => btn-lg</li></ul>
+        <td>
     </tr>
     <tr>
         <td>buttonsClass</td>
@@ -140,7 +141,7 @@ The table options are defined in `jQuery.fn.bootstrapTable.defaults`.
         <td>data-ajax</td>
         <td>Function</td>
         <td>undefined</td>
-        <td>A method to replace ajax call. Should implement the same API as jQuery ajax method</td>
+        <td>A method to replace ajax call. Should implement the same API as jQuery ajax method.</td>
     </tr>
     <tr>
         <td>method</td>
@@ -271,8 +272,8 @@ The table options are defined in `jQuery.fn.bootstrapTable.defaults`.
         <td>pageList</td>
         <td>data-page-list</td>
         <td>Array</td>
-        <td>[10, 25, 50, 100, All]</td>
-        <td>When set pagination property, initialize the page size selecting list. If you include the 'All' option, all the records will be shown in your table</td>
+        <td>[10, 25, 50, 100]</td>
+        <td>When set pagination property, initialize the page size selecting list. If you include the 'All' option, all the records will be shown in your table.</td>
     </tr>
     <tr>
         <td>selectItemName</td>
@@ -351,7 +352,7 @@ The table options are defined in `jQuery.fn.bootstrapTable.defaults`.
         <td>data-show-footer</td>
         <td>Boolean</td>
         <td>false</td>
-        <td>If true shows summary footer row</td>
+        <td>True to show the summary footer row.</td>
     </tr>
     <tr>
         <td>showColumns</td>
@@ -471,14 +472,14 @@ The table options are defined in `jQuery.fn.bootstrapTable.defaults`.
         <td>paginationPreText</td>
         <td>data-pagination-pre-text</td>
         <td>String</td>
-        <td>'&lt;'</td>
+        <td>'&lsaquo;'</td>
         <td>Indicate the icon or text to be shown in the pagination detail, the previous button.</td>
     </tr>
     <tr>
         <td>paginationNextText</td>
         <td>data-pagination-next-text</td>
         <td>String</td>
-        <td>'&gt;'</td>
+        <td>'&rsaquo;'</td>
         <td>Indicate the icon or text to be shown in the pagination detail, the next button.</td>
     </tr>
     <tr>
@@ -603,7 +604,7 @@ function rowStyle(value, row, index) {
      <tr>
         <td>locale</td>
         <td>data-locale</td>
-        <td>string</td>
+        <td>String</td>
         <td>undefined</td>
         <td>
         Sets the locale to use (i.e. <code>'fr-CA'</code>). Locale files must be pre-loaded.

+ 12 - 16
src/bootstrap-table.js

@@ -465,7 +465,7 @@
         }
     };
 
-    BootstrapTable.LOCALES = [];
+    BootstrapTable.LOCALES = {};
 
     BootstrapTable.LOCALES['en-US'] = BootstrapTable.LOCALES.en = {
         formatLoadingMessage: function () {
@@ -1057,6 +1057,7 @@
         if (this.options.showPaginationSwitch) {
             html.push(sprintf('<button class="btn' +
                     sprintf(' btn-%s', this.options.buttonsClass) +
+                    sprintf(' btn-%s', this.options.iconSize) +
                     '" type="button" name="paginationSwitch" title="%s">',
                     this.options.formatPaginationSwitch()),
                 sprintf('<i class="%s %s"></i>', this.options.iconsPrefix, this.options.icons.paginationSwitchDown),
@@ -1100,7 +1101,7 @@
                     return;
                 }
 
-                if (that.options.cardView && (!column.cardVisible)) {
+                if (that.options.cardView && !column.cardVisible) {
                     return;
                 }
 
@@ -1172,10 +1173,8 @@
             this.$toolbar.append(html.join(''));
             $search = this.$toolbar.find('.search input');
             $search.off('keyup drop').on('keyup drop', function (event) {
-                if (that.options.searchOnEnterKey) {
-                    if (event.keyCode !== 13) {
-                        return;
-                    }
+                if (that.options.searchOnEnterKey && event.keyCode !== 13) {
+                    return;
                 }
 
                 if ($.inArray(event.keyCode, [37, 38, 39, 40]) > -1) {
@@ -1228,19 +1227,15 @@
                 return;
             }
 
-            var s = !this.options.escape ? this.searchText && escapeHTML(this.searchText).toLowerCase()
-                                            : this.searchText && this.searchText.toLowerCase();
+            var s = this.searchText && (this.options.escape ?
+                escapeHTML(this.searchText) : this.searchText).toLowerCase();
             var f = $.isEmptyObject(this.filterColumns) ? null : this.filterColumns;
 
             // Check filter
             this.data = f ? $.grep(this.options.data, function (item, i) {
                 for (var key in f) {
-                    if ($.isArray(f[key])) {
-                        // TODO: remove this extra if statement
-                        if ($.inArray(item[key], f[key]) === -1) {
-                            return false;
-                        }
-                    } else if (item[key] !== f[key]) {
+                    if ($.isArray(f[key]) && $.inArray(item[key], f[key]) === -1 ||
+                            item[key] !== f[key]) {
                         return false;
                     }
                 }
@@ -1668,7 +1663,7 @@
                     return;
                 }
 
-                if (that.options.cardView && (!column.cardVisible)) {
+                if (that.options.cardView && !column.cardVisible) {
                     return;
                 }
 
@@ -2712,7 +2707,8 @@
         if (params && params.url) {
             this.options.pageNumber = 1;
         }
-        this.initServer(params && params.silent, params && params.query, params && params.url);
+        this.initServer(params && params.silent,
+            params && params.query, params && params.url);
         this.trigger('refresh', params);
     };