When you specify a key in the field definition which does not exist in your data object, the filterByFormatted
option doesn't work. I used a dedicated key to create a new field with a formatter
that combines three other fields which are not shown in the table.
Use the following template:
<template> <div> <b-input v-model="filter"></b-input> <b-table :fields="fields" :items="items" :filter="filter"></b-table> </div> </template> <script> export default { data() { return { filter: null, items: [{ col1: 'Item', col2: 'Something', }], fields: [{ key: 'col1', }, { key: 'col2', formatter: () => 'Foo', filterByFormatted: true, }, { key: 'col3', formatter: () => 'Bar', filterByFormatted: true, }] } }, } </script>
Or open https://codesandbox.io/s/jccv2?file=/App.vue.
Search on Foo
-> Item is still visible
Search on Bar
-> Item is no longer visible
b-table
should respect the new field when filterByFormatted
is set for it.
Libraries:
Environment:
See https://codesandbox.io/s/jccv2?file=/App.vue
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4