I have a table generated with bootstrap-vue that shows the results of a system search.
The Results Table shows the records to the user, and the user can sort them and filter them.
How can I add the search field underneath the table header <th>
generated with the bootstrap-vue <b-table>
element?
Have upvoted phil's answer, just making it more generic
You can use the
top-row
slot to customise your own first-row. See below for a bare-bones example.Note: I've used a computed property to filter the items instead of the
:filter
prop inb-table
because it doesn't render rows if all the items are filtered out, including your custom first-row. This way I can provide a dummy data row if the result is empty.mistake
Thanks to you for these useful answers. It saved some of my time today. However, in case items are given asynchronously i had to add a test on items size like this
On another hand if needed to have column with no filter, i added this test below
In the template
and within component methods