layout: docs title: Methods description: The Methods API of Bootstrap Table. group: api
The calling method syntax: $('#table').bootstrapTable('method', parameter).
Parameter: data
Detail:
Append the data to the table.
Parameter: index
Detail:
Check a row. The row index starts with 0.
Parameter: undefined
Detail:
Check all current page rows.
Parameter: params
Detail:
Check a row by an array of values, the params contain:
field: name of the field used to find records.values: array of values for rows to check.onlyCurrentPage (default false): If true, only the visible dataset will be checked. If pagination is used, the other pages will be ignored.
Example: Check/Uncheck By
Parameter: undefined
Detail:
Invert check of current page rows. Triggers onCheckSome and onUncheckSome events.
Parameter: undefined
Detail:
Collapse all rows if the detail view option is set to true.
Parameter: index
Detail:
Collapse the row with the index passed by parameter if the detail view option is set to true.
Parameter: uniqueId
Detail:
Collapse the row with the uniqueId passed by parameter if the detail view option is set to true.
Parameter: undefined
Detail:
Destroy the Bootstrap Table.
Parameter: undefined
Detail:
Expand all rows if the detail view option is set to true.
Parameter: index
Detail:
Expand the row that has the index passed by parameter if the detail view option is set to true.
Parameter: uniqueId
Detail:
Expand the row with the uniqueId passed by parameter if the detail view option is set to true.
Parameter:
filter - An Object of filter
Default: {}options - An Object of options
Default:
{
'filterAlgorithm': 'and'
}
Detail:
(Can used only in client-side) Filter data in the table. There are multiple ways to filter:
and filter.filterAlgorithm (see at parameter) to or to use the or filter.filterAlgorithm (see at parameter) to use a custom filter.Filter Algorithm
{age: 10} to show the data only age is equal to 10. You can also filter with an array of values, as in: {age: 10, hairColor: ['blue', 'red', 'green']} to find data where age is equal to 10 and hairColor is either blue, red, or green.{age: 10, name: "santa"} to show all Data which has a age of 10 or the name is equals to santa.Custom
true to keep the row and return false to filter the row.Example: Filter By
Parameter: params
Detail:
Get the loaded data of the table at the moment that this method is called
useCurrentPage: if set to true, the method will return the data only on the current page.includeHiddenRows: if set to true, the method will include the hidden rows.unfiltered: if set to true, the method will include all data (unfiltered).formatted: get the formatted value from the defined formatter.
Example: Get Data
Parameter: undefined
Detail:
Get hidden columns.
Parameter: show
Detail:
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.
Parameter: undefined
Detail:
Return the options object.
Parameter: id
Detail:
Get data from the table, the row that contains the id passed by parameter.
Parameter: undefined
Detail:
Get the current scroll position. The unit is 'px'.
Parameter: undefined
Detail:
Return selected rows. When no record is selected, an empty array will return. The selected rows will be unselected while some actions, e.g., searching or page change. If you want to maintain the selections, please use maintainMetaData.
Parameter: -
Detail:
Get visible columns.
Parameter: undefined
Detail:
Hide All the columns.
Parameter: field
Detail:
Hide the specified field column.
The parameter can be a string or an array of fields.
Parameter: undefined
Detail:
Hide loading status.
Parameter: params
Detail:
Hide the specified row. The params must contain at least one of the following properties:
index: the row index.uniqueId: the value of the uniqueId for that row.
Example: Show/Hide Row
Parameter: params
Detail:
Insert a new row. The params contain the following properties:
index: the row index to insert into.row: the row data.
Example: Insert Row
Parameter: data
Detail:
Load the data to the table. The old rows will be removed.
Parameter: params
Detail:
Merge some cells into one cell. The params contain the following properties:
index: the row index.field: the field name.rowspan: the rowspan count to be merged.colspan: the colspan count to be merged.
Example: Merge Cells
Parameter: undefined
Detail:
Go to the next page.
Parameter: data
Detail:
Prepend the data to the table.
Parameter: undefined
Detail:
Go to the previous page.
Parameter: params
Detail:
Refresh/reload the remote server data, you can set {silent: true} to refresh the data silently, and set {url: newUrl, pageNumber: pageNumber, pageSize: pageSize} to change the url (optional), page number (optional) and page size (optional). To supply query params specific to this request, set {query: {foo: 'bar'}}.
Parameter: options
Detail:
Refresh the table options.
Parameter: params
Detail:
Remove data from the table. The params contain two properties:
field: the field name of remove rows. If $index is not in your fields, you can use this special field $index to remove rows by row index.values: the array of values for rows that should be removed. If you use the special field $index, you can pass an array of indexes.
Example: Remove
Parameter: undefined
Detail:
Remove all data from the table.
Parameter: id
Detail:
Remove data from the table, the row that contains the id passed by parameter.
Parameter: text
Detail:
Set the search text.
Parameter: params
Detail:
Reset the Bootstrap Table view. For example, reset the table height, the params contain:
height: the height of the table.
Example: Reset View
Parameter: value|object
Detail:
value position, the unit is 'px', set 'bottom' means scroll to the bottom.px or rows (index starts by 0))
Default: {unit: 'px', value: 0}Example: Scroll To
Parameter: page
Detail:
Go to the specified page.
Parameter: undefined
Detail:
Show All the columns.
Parameter: field
Detail:
Show the specified field column.
The parameter can be a string or an array of fields.
Parameter: undefined
Detail:
Show loading status.
Parameter: params
Detail:
Show the specified row. The params must contain at least one of the following properties:
index: the row index.uniqueId: the value of the uniqueId for that row.
Example: Show/Hide Row
Parameter: index
Detail:
Toggle the row that has the index passed by parameter if the detail view option is set to true.
Parameter: undefined
Detail:
Toggle fullscreen.
Parameter: undefined
Detail:
Toggle the pagination option.
Parameter: undefined
Detail:
Toggle the card/table view.
Parameter: index
Detail:
Uncheck a row. The row index starts with 0.
Parameter: undefined
Detail:
Uncheck all current page rows.
Parameter: params
Detail:
Uncheck a row by an array of values. The params contain:
field: name of the field used to find records.values: array of values for rows to uncheck.onlyCurrentPage (default false): If true, only the visible dataset will be unchecked. If pagination is used, the other pages will be ignored.
Example: Check/Uncheck By
Parameter: params
Detail:
Update the specified row(s). Each param contains the following properties:
id: a row id where the id should be the uniqueId field assigned to the table.row: the new row data.replace (optional): set to true to replace the row instead of extending.
Example: Update By Unique Id
Parameter: params
Detail:
Update one cell. The params contain the following properties:
index: the row index.field: the field name.value: the new field value.To disable table re-initialization, you can set {reinit: false}.
Parameter: params
Detail:
Update the specified cell(s). Each param contains the following properties:
id: row id where the id should be the uniqueId field assigned to the table.field: field name of the cell to be updated.value: the new value of the cell.
Example: Update Cell By Unique Id
Parameter: params
Detail:
Update the field title of the column. The params contain the following properties:
field: the field name.title: the field title.
Example: Update Column Title
Parameter: formatName, text
Detail:
Update the localizations format text.
Example: Update Format Text
Parameter: params
Detail:
Update the specified row(s). Each param contains the following properties:
index: the row index to be updated.row: the new row data.replace (optional): set to true to replace the row instead of extending.
Example: Update Row