Skip to content

Commit

Permalink
fix(VDataTable): group-by column should be included in search (#10591)
Browse files Browse the repository at this point in the history
closes #10392

Co-authored-by: Andrew Henry <AMajesticPotatoe@gmail.com>
  • Loading branch information
nekosaur and MajesticPotatoe authored Feb 18, 2020
1 parent 065e93c commit a40e8d3
Show file tree
Hide file tree
Showing 3 changed files with 369 additions and 4 deletions.
4 changes: 2 additions & 2 deletions packages/vuetify/src/components/VDataTable/VDataTable.ts
Original file line number Diff line number Diff line change
Expand Up @@ -138,10 +138,10 @@ export default VDataIterator.extend({
}, {})
},
headersWithCustomFilters (): DataTableHeader[] {
return this.computedHeaders.filter(header => header.filter && (!header.hasOwnProperty('filterable') || header.filterable === true))
return this.headers.filter(header => header.filter && (!header.hasOwnProperty('filterable') || header.filterable === true))
},
headersWithoutCustomFilters (): DataTableHeader[] {
return this.computedHeaders.filter(header => !header.filter && (!header.hasOwnProperty('filterable') || header.filterable === true))
return this.headers.filter(header => !header.filter && (!header.hasOwnProperty('filterable') || header.filterable === true))
},
sanitizedHeaderProps (): Record<string, any> {
return camelizeObjectKeys(this.headerProps)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -673,6 +673,47 @@ describe('VDataTable.ts', () => {
expect(input).toHaveBeenNthCalledWith(2, [])
})

// https://github.com/vuetifyjs/vuetify/issues/10392
it('should search group-by column', async () => {
const headers = [
{
text: 'Name',
value: 'name',
},
{
text: 'ID',
value: 'id',
},
]

const items = [
{
name: 'Assistance',
id: 1,
},
{
name: 'Candidat',
id: 2,
},
]

const wrapper = mountFunction({
propsData: {
headers,
items,
itemKey: 'id',
groupBy: 'name',
},
})

expect(wrapper.html()).toMatchSnapshot()

wrapper.setProps({ search: 'candidat' })
await wrapper.vm.$nextTick()

expect(wrapper.html()).toMatchSnapshot()
})

// https://github.com/vuetifyjs/vuetify/issues/10289
it('should render item slot when using group-by function', async () => {
const wrapper = mountFunction({
Expand Down
Loading

0 comments on commit a40e8d3

Please sign in to comment.