Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Custom filter: undefined custom function in filters configuration property #67

Open
juaniyofm opened this issue Jul 12, 2021 · 1 comment

Comments

@juaniyofm
Copy link

juaniyofm commented Jul 12, 2021

I'm triying to filter by date field. For that, I'm using the custom filters functionality:

In the template:

<input type="date" class="form-control col-5" v-model="filters.birthday.value.min"
                                           :max="filters.birthday.value.max"/>
                                    <span class="col-1 text-center">-</span>
                                    <input type="date" class="form-control col-5" v-model="filters.birthday.value.max"
                                           :min="filters.birthday.value.min">

<v-table :data="data" :filters="filters" ... >

In the filters object:

birthday: {
                   value: { min: '', max: '' },
                    custom: this.birthdayFilter
                 }

In the created hook:

birthdayFilter (filterValue, row) {
                return row.birthday >= filterValue.min && row.birthday <= filterValue.max
            }

When the page is rendered, it throws errors:

  • Error in data(): "TypeError: Cannot read property 'birthdayFilter' of undefined"
  • Property or method "filters" is not defined on the instance but referenced during render. Make sure that this property is reactive, either in the data option, or for class-based components, by initializing the property

The basic filters work fine in the page, custom filters don't. I have followed the official documentation (https://tochoromero.github.io/vuejs-smart-table/filtering/#custom-filters) and my Vue version is 2.6.12

Thanks.

@juaniyofm juaniyofm changed the title Custom filter: undefined custom function in filters property Custom filter: undefined custom function in filters configuration property Jul 12, 2021
@adamjw3
Copy link

adamjw3 commented Mar 11, 2024

did you get this working?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants