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

How to clear/reset the component field? #65

Open
baermathias opened this issue Jun 5, 2020 · 1 comment
Open

How to clear/reset the component field? #65

baermathias opened this issue Jun 5, 2020 · 1 comment

Comments

@baermathias
Copy link

I am using nativescript-vue and several <DatePickerField>'s in a filter/search. After clearing/resetting the filter I need it to show the hint text or an empty field.

When setting date to an empty string :date="''" the component shows the value 01.01.1970, so my method to clear it is by re-rendering the component and give each a key :key="keyVar1" with a random value this.keyVar1 = Math.random().toString(36).substring(2,15);.

Is there a more native method or is re-rendering the way to go here?

@baermathias
Copy link
Author

I found out, that it is possible to pass undefined to date:

:date="undefined"

If this happens, the value of hint property will be shown preferred. Imo the same behaviour should happen with null and empty strings. Also this behaviour should be documented somewhere.
So another solution can be to set hint to e.g. hint=" " and pass undefinded to date.

Maybe this info helps somebody.

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

1 participant