corrade-nucleus-nucleons – Blame information for rev 20
?pathlinks?
Rev | Author | Line No. | Line |
---|---|---|---|
20 | office | 1 | # 方法 []({{ site.repo }}/blob/develop/docs/_i18n/{{ site.lang }}/documentation/methods.md) |
2 | |||
3 | --- |
||
4 | |||
5 | 使用方法的语法:`$('#table').bootstrapTable('method', parameter);`。 |
||
6 | |||
7 | <table class="table" |
||
8 | id="m" |
||
9 | data-search="true" |
||
10 | data-show-toggle="true" |
||
11 | data-show-columns="true" |
||
12 | data-mobile-responsive="true"> |
||
13 | <thead> |
||
14 | <tr> |
||
15 | <th>名称</th> |
||
16 | <th>参数</th> |
||
17 | <th>描述</th> |
||
18 | <th data-formatter="methodFormatter" |
||
19 | data-align="center" |
||
20 | data-valign="middle">例子</th> |
||
21 | </tr> |
||
22 | </thead> |
||
23 | <tbody> |
||
24 | <tr> |
||
25 | <td>getOptions</td> |
||
26 | <td>none</td> |
||
27 | <td>返回表格的 Options。</td> |
||
28 | <td>getOptions</td> |
||
29 | </tr> |
||
30 | <tr> |
||
31 | <td>getSelections</td> |
||
32 | <td>none</td> |
||
33 | <td>返回所选的行,当没有选择任何行的时候返回一个空数组。</td> |
||
34 | <td>getSelections</td> |
||
35 | </tr> |
||
36 | <tr> |
||
37 | <td>getAllSelections</td> |
||
38 | <td>none</td> |
||
39 | <td>返回所有选择的行,包括搜索过滤前的,当没有选择任何行的时候返回一个空数组。</td> |
||
40 | <td>getAllSelections</td> |
||
41 | </tr> |
||
42 | <tr> |
||
43 | <td>getData</td> |
||
44 | <td>useCurrentPage</td> |
||
45 | <td>或者当前加载的数据。假如设置 useCurrentPage 为 true,则返回当前页的数据。</td> |
||
46 | <td>getData</td> |
||
47 | </tr> |
||
48 | <tr> |
||
49 | <td>getRowByUniqueId</td> |
||
50 | <td>id</td> |
||
51 | <td>根据 uniqueId 获取行数据。</td> |
||
52 | <td>getRowByUniqueId</td> |
||
53 | </tr> |
||
54 | <tr> |
||
55 | <td>load</td> |
||
56 | <td>data</td> |
||
57 | <td>加载数据到表格中,旧数据会被替换。</td> |
||
58 | <td>load</td> |
||
59 | </tr> |
||
60 | <tr> |
||
61 | <td>showAllColumns</td> |
||
62 | <td>none</td> |
||
63 | <td>Show All the columns.</td> |
||
64 | <td>showAllColumns</td> |
||
65 | </tr> |
||
66 | <tr> |
||
67 | <td>hideAllColumns</td> |
||
68 | <td>none</td> |
||
69 | <td>Hide All the columns.</td> |
||
70 | <td>hidAllColumns</td> |
||
71 | </tr> |
||
72 | <tr> |
||
73 | <td>append</td> |
||
74 | <td>data</td> |
||
75 | <td>添加数据到表格在现有数据之后。</td> |
||
76 | <td>append</td> |
||
77 | </tr> |
||
78 | <tr> |
||
79 | <td>prepend</td> |
||
80 | <td>data</td> |
||
81 | <td>插入数据到表格在现有数据之前。</td> |
||
82 | <td>prepend</td> |
||
83 | </tr> |
||
84 | <tr> |
||
85 | <td>remove</td> |
||
86 | <td>params</td> |
||
87 | <td> |
||
88 | 从表格中删除数据,包括两个参数: |
||
89 | field: 需要删除的行的 field 名称。<br> |
||
90 | values: 需要删除的行的值,类型为数组。<br> |
||
91 | </td> |
||
92 | <td>remove</td> |
||
93 | </tr> |
||
94 | <tr> |
||
95 | <td>removeAll</td> |
||
96 | <td>-</td> |
||
97 | <td>删除表格所有数据。</td> |
||
98 | <td>removeAll</td> |
||
99 | </tr> |
||
100 | <tr> |
||
101 | <td>removeByUniqueId</td> |
||
102 | <td>id</td> |
||
103 | <td>根据 uniqueId 删除指定的行。</td> |
||
104 | <td>removeByUniqueId</td> |
||
105 | </tr> |
||
106 | <tr> |
||
107 | <td>insertRow</td> |
||
108 | <td>params</td> |
||
109 | <td> |
||
110 | 插入新行,参数包括:<br> |
||
111 | index: 要插入的行的 index。<br> |
||
112 | row: 行的数据,Object 对象。 |
||
113 | </td> |
||
114 | <td>insertRow</td> |
||
115 | </tr> |
||
116 | <tr> |
||
117 | <td>updateRow</td> |
||
118 | <td>params</td> |
||
119 | <td> |
||
120 | 更新指定的行,参数包括:<br> |
||
121 | index: 要更新的行的 index。<br> |
||
122 | row: 行的数据,Object 对象。 |
||
123 | </td> |
||
124 | <td>updateRow</td> |
||
125 | </tr> |
||
126 | <tr> |
||
127 | <td>showRow</td> |
||
128 | <td>params</td> |
||
129 | <td>显示指定的行,参数包括:<br> |
||
130 | index: 要更新的行的 index 或者 uniqueId。<br> |
||
131 | isIdField: 指定 index 是否为 uniqueid。</td> |
||
132 | <td>showRow-hideRow</td> |
||
133 | </tr> |
||
134 | <tr> |
||
135 | <td>hideRow</td> |
||
136 | <td>params</td> |
||
137 | <td>显示指定的行,参数包括:<br> |
||
138 | index: 要更新的行的 index。<br> |
||
139 | uniqueId: 或者要更新的行的 uniqueid。 |
||
140 | <td>showRow-hideRow</td> |
||
141 | </tr> |
||
142 | <tr> |
||
143 | <td>getRowsHidden</td> |
||
144 | <td>show</td> |
||
145 | <td>Get all rows hidden and if you pass the show parameter true the rows will be shown again, otherwise, the method |
||
146 | only will return the rows hidden.</td> |
||
147 | </tr> |
||
148 | <tr> |
||
149 | <td>mergeCells</td> |
||
150 | <td>options</td> |
||
151 | <td> |
||
152 | Merge some cells to one cell, the options contains following properties: <br> |
||
153 | index: the row index. <br> |
||
154 | field: the field name.<br> |
||
155 | rowspan: the rowspan count to be merged. <br> |
||
156 | colspan: the colspan count to be merged. |
||
157 | </td> |
||
158 | </tr> |
||
159 | <tr> |
||
160 | <td>updateCell</td> |
||
161 | <td>params</td> |
||
162 | <td> |
||
163 | Update one cell, the params contains following properties: <br> |
||
164 | index: the row index. <br> |
||
165 | field: the field name.<br> |
||
166 | value: the new field value. |
||
167 | </td> |
||
168 | </tr> |
||
169 | <tr> |
||
170 | <td>refresh</td> |
||
171 | <td>params</td> |
||
172 | <td>Refresh the remote server data, you can set <code>{silent: true}</code> to refresh the data silently, and set <code>{url: newUrl}</code> to change the url. To supply query params specific to this request, set <code>{query: {foo: 'bar'}}</code></td> |
||
173 | </tr> |
||
174 | <tr> |
||
175 | <td>refreshOptions</td> |
||
176 | <td>options</td> |
||
177 | <td>Refresh the options</td> |
||
178 | </tr> |
||
179 | <tr> |
||
180 | <td>resetSearch</td> |
||
181 | <td>text</td> |
||
182 | <td>Set the search text</td> |
||
183 | </tr> |
||
184 | <tr> |
||
185 | <td>showLoading</td> |
||
186 | <td>none</td> |
||
187 | <td>Show loading status.</td> |
||
188 | </tr> |
||
189 | <tr> |
||
190 | <td>hideLoading</td> |
||
191 | <td>none</td> |
||
192 | <td>Hide loading status.</td> |
||
193 | </tr> |
||
194 | <tr> |
||
195 | <td>checkAll</td> |
||
196 | <td>none</td> |
||
197 | <td>Check all current page rows.</td> |
||
198 | </tr> |
||
199 | <tr> |
||
200 | <td>uncheckAll</td> |
||
201 | <td>none</td> |
||
202 | <td>Uncheck all current page rows.</td> |
||
203 | </tr> |
||
204 | <tr> |
||
205 | <td>check</td> |
||
206 | <td>index</td> |
||
207 | <td>Check a row, the row index start with 0.</td> |
||
208 | </tr> |
||
209 | <tr> |
||
210 | <td>uncheck</td> |
||
211 | <td>index</td> |
||
212 | <td>Uncheck a row, the row index start with 0.</td> |
||
213 | </tr> |
||
214 | <tr> |
||
215 | <td>checkBy</td> |
||
216 | <td>params</td> |
||
217 | <td> |
||
218 | Check a row by array of values, the params contains:<br> |
||
219 | field: name of the field used to find records<br> |
||
220 | values: array of values for rows to check<br> |
||
221 | Example: <br> |
||
222 | $("#table").bootstrapTable("checkBy", {field:"field_name", values:["value1","value2","value3"]}) |
||
223 | </td> |
||
224 | </tr> |
||
225 | <tr> |
||
226 | <td>uncheckBy</td> |
||
227 | <td>params</td> |
||
228 | <td> |
||
229 | Uncheck a row by array of values, the params contains:<br> |
||
230 | field: name of the field used to find records<br> |
||
231 | values: array of values for rows to uncheck<br> |
||
232 | Example: <br> |
||
233 | $("#table").bootstrapTable("uncheckBy", {field:"field_name", values:["value1","value2","value3"]}) |
||
234 | </td> |
||
235 | </tr> |
||
236 | <tr> |
||
237 | <td>resetView</td> |
||
238 | <td>params</td> |
||
239 | <td>Reset the bootstrap table view, for example reset the table height.</td> |
||
240 | </tr> |
||
241 | <tr> |
||
242 | <td>resetWidth</td> |
||
243 | <td>none</td> |
||
244 | <td>Resizes header and footer to fit current columns width</td> |
||
245 | </tr> |
||
246 | <tr> |
||
247 | <td>destroy</td> |
||
248 | <td>none</td> |
||
249 | <td>Destroy the bootstrap table.</td> |
||
250 | </tr> |
||
251 | <tr> |
||
252 | <td>showColumn</td> |
||
253 | <td>field</td> |
||
254 | <td>Show the specified column.</td> |
||
255 | </tr> |
||
256 | <tr> |
||
257 | <td>hideColumn</td> |
||
258 | <td>field</td> |
||
259 | <td>Hide the specified column.</td> |
||
260 | </tr> |
||
261 | <tr> |
||
262 | <td>getHiddenColumns</td> |
||
263 | <td>-</td> |
||
264 | <td>获取隐藏的列。</td> |
||
265 | </tr> |
||
266 | <tr> |
||
267 | <td>getVisibleColumns</td> |
||
268 | <td>-</td> |
||
269 | <td>获取可见列。</td> |
||
270 | </tr> |
||
271 | <tr> |
||
272 | <td>scrollTo</td> |
||
273 | <td>value</td> |
||
274 | <td>滚动到指定位置,单位为 px,设置 'bottom' 表示跳到最后。</td> |
||
275 | </tr> |
||
276 | <tr> |
||
277 | <td>getScrollPosition</td> |
||
278 | <td>none</td> |
||
279 | <td>获取当前滚动条的位置,单位为 px。</td> |
||
280 | </tr> |
||
281 | <tr> |
||
282 | <td>filterBy</td> |
||
283 | <td>params</td> |
||
284 | <td>(只能用于 client 端)过滤表格数据, 你可以通过过滤<code>{age: 10}</code>来显示 age 等于 10 的数据。</td> |
||
285 | </tr> |
||
286 | <tr> |
||
287 | <td>selectPage</td> |
||
288 | <td>page</td> |
||
289 | <td>跳到指定的页。</td> |
||
290 | </tr> |
||
291 | <tr> |
||
292 | <td>prevPage</td> |
||
293 | <td>none</td> |
||
294 | <td>跳到上一页。</td> |
||
295 | </tr> |
||
296 | <tr> |
||
297 | <td>nextPage</td> |
||
298 | <td>none</td> |
||
299 | <td>跳到下一页。</td> |
||
300 | </tr> |
||
301 | <tr> |
||
302 | <td>togglePagination</td> |
||
303 | <td>none</td> |
||
304 | <td>切换分页选项。</td> |
||
305 | </tr> |
||
306 | <tr> |
||
307 | <td>toggleView</td> |
||
308 | <td>none</td> |
||
309 | <td>切换 card/table 视图</td> |
||
310 | </tr> |
||
311 | <tr> |
||
312 | <td>expandRow</td> |
||
313 | <td>index</td> |
||
314 | <td>Expand the row that has the index passed by parameter if the detail view option is set to True.</td> |
||
315 | </tr> |
||
316 | <tr> |
||
317 | <td>collapseRow</td> |
||
318 | <td>index</td> |
||
319 | <td>Collapse the row that has the index passed by parameter if the detail view option is set to True.</td> |
||
320 | </tr> |
||
321 | <tr> |
||
322 | <td>expandAllRows</td> |
||
323 | <td>is subtable</td> |
||
324 | <td>Expand all rows if the detail view option is set to True.</td> |
||
325 | </tr> |
||
326 | <tr> |
||
327 | <td>collapseAllRows</td> |
||
328 | <td>is subtable</td> |
||
329 | <td>Collapse all rows if the detail view option is set to True.</td> |
||
330 | </tr> |
||
331 | </tbody> |
||
332 | </table> |