ソースを参照

Merge pull request #341 from D0d0/patch-2

searchTimeOut
文翼 11 年 前
コミット
fb5717d4a6
2 ファイル変更10 行追加2 行削除
  1. 8 1
      docs/_includes/documentation/table-options.md
  2. 2 1
      src/bootstrap-table.js

+ 8 - 1
docs/_includes/documentation/table-options.md

@@ -203,6 +203,13 @@ The table options is defined in `jQuery.fn.bootstrapTable.defaults`.
         <td>Enable the search input.</td>
     </tr>
     <tr>
+        <td>searchTimeOut</td>
+        <td>data-search-time-out</td>
+        <td>Number</td>
+        <td>500</td>
+        <td>Set timeout for search fire.</td>
+    </tr>
+    <tr>
         <td>showHeader</td>
         <td>data-show-header</td>
         <td>Boolean</td>
@@ -337,4 +344,4 @@ The table options is defined in `jQuery.fn.bootstrapTable.defaults`.
         </td>
     </tr>
     </tbody>
-</table>
+</table>

+ 2 - 1
src/bootstrap-table.js

@@ -165,6 +165,7 @@
         checkboxHeader: true,
         sortable: true,
         maintainSelected: false,
+        searchTimeOut: 500,
 
         rowStyle: function (row, index) {return {};},
 
@@ -645,7 +646,7 @@
                 clearTimeout(timeoutId); // doesn't matter if it's 0
                 timeoutId = setTimeout(function () {
                     that.onSearch(event);
-                }, 500); // 500ms
+                }, that.options.searchTimeOut);
             });
         }
     };