Member-only story
BootstrapVue — Table Filtering and Loading
4 min readOct 1, 2020
To make good looking Vue apps, we need to style our components.
To make our lives easier, we can use components with styles built-in.
We look at how to customize table contents, including filtering.
Filtering
BootstrapVue table contents can be filtered.
To add built-in filtering features, we can add the filter
prop.
For example, we can write:
<template>
<div id="app">
<b-table :items="items" filter="may"></b-table>
</div>
</template><script>
export default {
name: "App",
data() {
return {
items: [
{ id: 1, firstName: "alex", lastName: "green" },
{
id: 2,
firstName: "may",
lastName: "smith"
},
{ id: 3, firstName: "james", lastName: "jones" }
]
};
}
};
</script>
We just pass in a string into the filter
prop and it’ll find the rows with the word 'may'
in it by searching all properties.
Also, we can pass in a regex to filter by a pattern.
Pagination
We can use the b-pagination
component with b-table
to control pagination.