|
|
@@ -1,8 +1,8 @@
|
|
|
-# Methods []({{ site.repo }}/blob/master/docs/_i18n/{{ site.lang }}/documentation/methods.md)
|
|
|
+# 方法 []({{ site.repo }}/blob/master/docs/_i18n/{{ site.lang }}/documentation/methods.md)
|
|
|
|
|
|
---
|
|
|
|
|
|
-The calling method syntax: `$('#table').bootstrapTable('method', parameter);`.
|
|
|
+使用方法的语法:`$('#table').bootstrapTable('method', parameter);`。
|
|
|
|
|
|
<table class="table"
|
|
|
id="m"
|
|
|
@@ -12,111 +12,124 @@ The calling method syntax: `$('#table').bootstrapTable('method', parameter);`.
|
|
|
data-mobile-responsive="true">
|
|
|
<thead>
|
|
|
<tr>
|
|
|
- <th>Name</th>
|
|
|
- <th>Parameter</th>
|
|
|
- <th>Description</th>
|
|
|
+ <th>名称</th>
|
|
|
+ <th>参数</th>
|
|
|
+ <th>描述</th>
|
|
|
+ <th data-formatter="methodFormatter"
|
|
|
+ data-align="center"
|
|
|
+ data-valign="middle">例子</th>
|
|
|
</tr>
|
|
|
</thead>
|
|
|
<tbody>
|
|
|
<tr>
|
|
|
<td>getOptions</td>
|
|
|
<td>none</td>
|
|
|
- <td>Return the options object.</td>
|
|
|
+ <td>返回表格的 Options。</td>
|
|
|
+ <td>getOptions</td>
|
|
|
</tr>
|
|
|
<tr>
|
|
|
<td>getSelections</td>
|
|
|
<td>none</td>
|
|
|
- <td>Return all selected rows, when no record selected, am empty array will return.</td>
|
|
|
+ <td>返回所选的行,当没有选择任何行的时候返回一个空数组。</td>
|
|
|
+ <td>getSelections</td>
|
|
|
+ </tr>
|
|
|
+ <tr>
|
|
|
+ <td>getAllSelections</td>
|
|
|
+ <td>none</td>
|
|
|
+ <td>返回所有选择的行,包括搜索过滤前的,当没有选择任何行的时候返回一个空数组。</td>
|
|
|
+ <td>getAllSelections</td>
|
|
|
</tr>
|
|
|
<tr>
|
|
|
<td>getData</td>
|
|
|
<td>useCurrentPage</td>
|
|
|
- <td>Get the loaded data of table. If you set the useCurrentPage to true the method will return the data in the current page</td>
|
|
|
+ <td>或者当前加载的数据。假如设置 useCurrentPage 为 true,则返回当前页的数据。</td>
|
|
|
+ <td>getData</td>
|
|
|
+ </tr>
|
|
|
+ <tr>
|
|
|
+ <td>getRowByUniqueId</td>
|
|
|
+ <td>id</td>
|
|
|
+ <td>根据 uniqueId 获取行数据。</td>
|
|
|
+ <td>getRowByUniqueId</td>
|
|
|
</tr>
|
|
|
<tr>
|
|
|
<td>load</td>
|
|
|
<td>data</td>
|
|
|
- <td>Load the data to table, the old rows will be removed.</td>
|
|
|
+ <td>加载数据到表格中,旧数据会被替换。</td>
|
|
|
+ <td>load</td>
|
|
|
</tr>
|
|
|
<tr>
|
|
|
<td>append</td>
|
|
|
<td>data</td>
|
|
|
- <td>Append the data to table.</td>
|
|
|
+ <td>添加数据到表格在现有数据之后。</td>
|
|
|
+ <td>append</td>
|
|
|
</tr>
|
|
|
<tr>
|
|
|
<td>prepend</td>
|
|
|
<td>data</td>
|
|
|
- <td>Prepend the data to table.</td>
|
|
|
+ <td>插入数据到表格在现有数据之前。</td>
|
|
|
+ <td>prepend</td>
|
|
|
</tr>
|
|
|
<tr>
|
|
|
<td>remove</td>
|
|
|
<td>params</td>
|
|
|
<td>
|
|
|
- Remove data from table, the params contains two properties: <br>
|
|
|
- field: the field name of remove rows. <br>
|
|
|
- values: the array of values for rows which should be removed. <br>
|
|
|
- Example: $('#myTable').bootstrapTable('remove', {field: 'id', values: ["73", "74"]})
|
|
|
+ 从表格中删除数据,包括两个参数:
|
|
|
+ field: 需要删除的行的 field 名称。<br>
|
|
|
+ values: 需要删除的行的值,类型为数组。<br>
|
|
|
</td>
|
|
|
+ <td>remove</td>
|
|
|
</tr>
|
|
|
<tr>
|
|
|
<td>removeAll</td>
|
|
|
<td>-</td>
|
|
|
- <td>
|
|
|
- Remove all data from table<br>
|
|
|
- Example: $('#myTable').bootstrapTable('removeAll')
|
|
|
- </td>
|
|
|
+ <td>删除表格所有数据。</td>
|
|
|
+ <td>removeAll</td>
|
|
|
</tr>
|
|
|
<tr>
|
|
|
<td>removeByUniqueId</td>
|
|
|
<td>id</td>
|
|
|
- <td>
|
|
|
- Remove data from table, the row that contains the id passed by parameter<br>
|
|
|
- Example: $('#myTable').bootstrapTable('removeByUniqueId', "122")
|
|
|
- </td>
|
|
|
- </tr>
|
|
|
- <tr>
|
|
|
- <td>getRowByUniqueId</td>
|
|
|
- <td>id</td>
|
|
|
- <td>
|
|
|
- Get data from table, the row that contains the id passed by parameter<br>
|
|
|
- Example: $('#myTable').bootstrapTable('getRowByUniqueId', "122")
|
|
|
- </td>
|
|
|
+ <td>根据 uniqueId 删除指定的行。</td>
|
|
|
+ <td>removeByUniqueId</td>
|
|
|
</tr>
|
|
|
<tr>
|
|
|
<td>insertRow</td>
|
|
|
<td>params</td>
|
|
|
<td>
|
|
|
- Insert a new row, the param contains following properties:<br>
|
|
|
- index: the row index to insert into.<br>
|
|
|
- row: the row data.
|
|
|
+ 插入新行,参数包括:<br>
|
|
|
+ index: 要插入的行的 index。<br>
|
|
|
+ row: 行的数据,Object 对象。
|
|
|
</td>
|
|
|
+ <td>insertRow</td>
|
|
|
</tr>
|
|
|
<tr>
|
|
|
<td>updateRow</td>
|
|
|
<td>params</td>
|
|
|
<td>
|
|
|
- Update the specified row, the param contains following properties: <br>
|
|
|
- index: the row index to be updated. <br>
|
|
|
- row: the new row data.
|
|
|
+ 更新指定的行,参数包括:<br>
|
|
|
+ index: 要更新的行的 index。<br>
|
|
|
+ row: 行的数据,Object 对象。
|
|
|
</td>
|
|
|
+ <td>updateRow</td>
|
|
|
</tr>
|
|
|
<tr>
|
|
|
<td>showRow</td>
|
|
|
<td>params</td>
|
|
|
- <td>Show the specified row. the param contains following properties:
|
|
|
- index: the row idenx or the idField.
|
|
|
- isIdField: Boolean to indicates if index is the idField od the row or not.</td>
|
|
|
+ <td>显示指定的行,参数包括:<br>
|
|
|
+ index: 要更新的行的 index 或者 uniqueId。<br>
|
|
|
+ isIdField: 指定 index 是否为 uniqueid。</td>
|
|
|
+ <td>showRow-hideRow</td>
|
|
|
</tr>
|
|
|
<tr>
|
|
|
<td>hideRow</td>
|
|
|
<td>params</td>
|
|
|
- <td>Hide the specified row. the param contains following properties:
|
|
|
- index: the row idenx or the idField.
|
|
|
- isIdField: Boolean to indicates if index is the idField od the row or not.</td>
|
|
|
+ <td>显示指定的行,参数包括:<br>
|
|
|
+ index: 要更新的行的 index。<br>
|
|
|
+ uniqueId: 或者要更新的行的 uniqueid。
|
|
|
+ <td>showRow-hideRow</td>
|
|
|
</tr>
|
|
|
<tr>
|
|
|
<td>getRowsHidden</td>
|
|
|
- <td>boolean</td>
|
|
|
+ <td>show</td>
|
|
|
<td>Get all rows hidden and if you pass the show parameter true the rows will be shown again, otherwise, the method
|
|
|
only will return the rows hidden.</td>
|
|
|
</tr>
|
|
|
@@ -136,9 +149,9 @@ The calling method syntax: `$('#table').bootstrapTable('method', parameter);`.
|
|
|
<td>params</td>
|
|
|
<td>
|
|
|
Update one cell, the params contains following properties: <br>
|
|
|
- rowIndex: the row index. <br>
|
|
|
- fieldName: the field name.<br>
|
|
|
- fieldValue: the new field value. <br>
|
|
|
+ index: the row index. <br>
|
|
|
+ field: the field name.<br>
|
|
|
+ value: the new field value.
|
|
|
</td>
|
|
|
</tr>
|
|
|
<tr>
|
|
|
@@ -231,52 +244,47 @@ The calling method syntax: `$('#table').bootstrapTable('method', parameter);`.
|
|
|
<tr>
|
|
|
<td>getHiddenColumns</td>
|
|
|
<td>-</td>
|
|
|
- <td>Get hidden columns.</td>
|
|
|
+ <td>获取隐藏的列。</td>
|
|
|
</tr>
|
|
|
<tr>
|
|
|
<td>scrollTo</td>
|
|
|
<td>value</td>
|
|
|
- <td>Scroll to the number value position, set 'bottom' means scroll to the bottom.</td>
|
|
|
+ <td>滚动到指定位置,单位为 px,设置 'bottom' 表示跳到最后。</td>
|
|
|
</tr>
|
|
|
<tr>
|
|
|
<td>getScrollPosition</td>
|
|
|
<td>none</td>
|
|
|
- <td>Get the current scroll position.</td>
|
|
|
+ <td>获取当前滚动条的位置,单位为 px。</td>
|
|
|
</tr>
|
|
|
<tr>
|
|
|
<td>filterBy</td>
|
|
|
<td>params</td>
|
|
|
- <td>(Can use only in client-side)Filter data in table, eg. you can filter <code>{age: 10}</code> to show the data only age is equal to 10.</td>
|
|
|
+ <td>(只能用于 client 端)过滤表格数据, 你可以通过过滤<code>{age: 10}</code>来显示 age 等于 10 的数据。</td>
|
|
|
</tr>
|
|
|
<tr>
|
|
|
<td>selectPage</td>
|
|
|
<td>page</td>
|
|
|
- <td>Go to the a specified page.</td>
|
|
|
+ <td>跳到指定的页。</td>
|
|
|
</tr>
|
|
|
<tr>
|
|
|
<td>prevPage</td>
|
|
|
<td>none</td>
|
|
|
- <td>Go to previous page.</td>
|
|
|
+ <td>跳到上一页。</td>
|
|
|
</tr>
|
|
|
<tr>
|
|
|
<td>nextPage</td>
|
|
|
<td>none</td>
|
|
|
- <td>Go to next page.</td>
|
|
|
+ <td>跳到下一页。</td>
|
|
|
</tr>
|
|
|
<tr>
|
|
|
<td>togglePagination</td>
|
|
|
<td>none</td>
|
|
|
- <td>Toggle the pagination option.</td>
|
|
|
+ <td>切换分页选项。</td>
|
|
|
</tr>
|
|
|
<tr>
|
|
|
<td>toggleView</td>
|
|
|
<td>none</td>
|
|
|
- <td>Toggle the card/table view.</td>
|
|
|
- </tr>
|
|
|
- <tr>
|
|
|
- <td>deleteCookie</td>
|
|
|
- <td>cookie name</td>
|
|
|
- <td>Delete a cookie created. You must use: 'sortOrder', 'sortName', 'pageNumber' or 'pageList'.</td>
|
|
|
+ <td>切换 card/table 视图</td>
|
|
|
</tr>
|
|
|
<tr>
|
|
|
<td>expandRow</td>
|