methods.md 4.8 KB

Methods []({{ site.repo }}/blob/master/docs/_i18n/{{ site.lang }}/documentation/methods.md)


The calling method syntax: $('#table').bootstrapTable('method', parameter);.

Name Parameter Description
getOptions none Return the options object.
getSelections none Return all selected rows, when no record selected, am empty array will return.
getData none Get the loaded data of table.
load data Load the data to table, the old rows will be removed.
append data Append the data to table.
prepend data Prepend the data to table.
remove params Remove data from table, the params contains two properties:
field: the field name of remove rows.
values: the array of values for rows which should be removed.
Example: $('#myTable').bootstrapTable('remove', {field: 'id', values: ["73", "74"]})
insertRow params Insert a new row, the param contains following properties:
index: the row index to insert into.
row: the row data.
updateRow params Update the specified row, the param contains following properties:
index: the row index to be updated.
row: the new row data.
mergeCells options Merge some cells to one cell, the options contains following properties:
index: the row index.
field: the field name.
rowspan: the rowspan count to be merged.
colspan: the colspan count to be merged.
refresh params Refresh the remote server data, you can set {silent: true} to refresh the data silently, and set {url: newUrl} to change the url. To supply query params specific to this request, set {query: {foo: 'bar'}}
showLoading none Show loading status.
hideLoading none Hide loading status.
checkAll none Check all current page rows.
uncheckAll none Uncheck all current page rows.
check index Check a row, the row index start with 0.
uncheck index Uncheck a row, the row index start with 0.
resetView params Reset the bootstrap table view, for example reset the table height.
destroy none Destroy the bootstrap table.
showColumn field Show the specified column.
hideColumn field Hide the specified column.
scrollTo value Scroll to the number value position, set 'bottom' means scroll to the bottom.
filterBy params (Can use only in client-side)Filter data in table, eg. you can filter {age: 10} to show the data only age is equal to 10.
selectPage page Go to the a specified page.
prevPage none Go to previous page.
nextPage none Go to next page.
togglePagination none Toggle the pagination option.
toggleView none Toggle the card/table view.