Vue-good-table: Global Search reset

Created on 30 Oct 2018  路  6Comments  路  Source: xaksis/vue-good-table

Issue Type

  • [x] Question
    How do you reset the Global Search input field?
    Is there a method that can be called on a button to clear the field?

This only resets filters, not search.

this.$refs['my-table'].reset();

(referencing #145)

enhancement

Most helpful comment

Sorry for being such a pain @xaksis hahaha
I think this is already handled if we just use:

this.$refs['my-table'].globalSearchTerm = '';

I would just include this in the reset method.

This came up because I created external date range & groupings that interact with my VGT, but every time I would change the date range and/or the grouping, any existing global search/column filters would persist. So I figured out that I needed to call reset() but this only handled half of the task, missing the search clear.

All 6 comments

Might also be useful to set an initialValue for Global Search.

Makes sense. I'll look into this.

Sorry for being such a pain @xaksis hahaha
I think this is already handled if we just use:

this.$refs['my-table'].globalSearchTerm = '';

I would just include this in the reset method.

This came up because I created external date range & groupings that interact with my VGT, but every time I would change the date range and/or the grouping, any existing global search/column filters would persist. So I figured out that I needed to call reset() but this only handled half of the task, missing the search clear.

For an initial value, adding this in mounted() works:

this.$refs['my-table'].globalSearchTerm = 'my initial value';

@oflittlemother haha you're helping improve good table for everyone! releases might not come as fast as I hope them to, but all your input is appreciated!

Please keep this open and, I think this should be in the documentation.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

mustfullDev picture mustfullDev  路  3Comments

jannishuebl picture jannishuebl  路  3Comments

davidjr82 picture davidjr82  路  6Comments

LiamMcArthur picture LiamMcArthur  路  3Comments

advicepyro picture advicepyro  路  3Comments