methods.md 7.1 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 selected rows, when no record selected, am empty array will return.
getAllSelections none Return selected rows in all pages, when no record selected, am empty array will return.
getData useCurrentPage Get the loaded data of table. If you set the useCurrentPage to true the method will return the data in the current page
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.
showRow params Show the specified row. the param contains following properties: index: the row index or the idField. isIdField: Boolean to indicates if index is the idField od the row or not.
hideRow params Hide the specified row. the param contains following properties: index: the row index or the idField. isIdField: Boolean to indicates if index is the idField od the row or not.
getRowsHidden boolean 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.
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.
checkBy params Check a row by array of values, the params contains:
field: name of the field used to find records
values: array of values for rows to check
Example:
$("#table").bootstrapTable("checkBy", {field:"field_name", values:["value1","value2","value3"]})
uncheckBy params Uncheck a row by array of values, the params contains:
field: name of the field used to find records
values: array of values for rows to uncheck
Example:
$("#table").bootstrapTable("uncheckBy", {field:"field_name", values:["value1","value2","value3"]})
resetView params Reset the bootstrap table view, for example reset the table height.
resetWidth none Resizes header and footer to fit current columns width
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.
getScrollPosition none Get the current scroll position.
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.
deleteCookie cookie name Delete a cookie created. You must use: 'sortOrder', 'sortName', 'pageNumber' or 'pageList'.