nativescript-datetimepicker icon indicating copy to clipboard operation
nativescript-datetimepicker copied to clipboard

no events

Open kapil9-10 opened this issue 5 years ago • 3 comments

is there any event which triggers on when you click on ok button on datePicker

kapil9-10 avatar Jun 11 '20 02:06 kapil9-10

Hey @kapil9-10,

Did you check the Getting/Setting Date and Time section on Features?

You can listen to the dateChange event on DatePickerField.

Here is an example of using it with vue binding:

<DatePickerField @dateChange="onDateTimeChange1" :date="dateTime1"></DatePickerField>

Where dateTime1 is your date, for example:

data() { return { dateTime1: new Date(), } },

Then in your methods:

methods: { onDateTimeChange1: function(args) { this.dateTime1 = args.value; },

So it will get the date on args.value when you click the 'OK' button. If you click 'Cancel', it will no get the value and it will keep the old one.

Hope it helps.

giulianimartini avatar Jun 11 '20 19:06 giulianimartini

thanks for help,, one more query how will I know when he just scroll or clicked ok

kapil9-10 avatar Aug 25 '20 21:08 kapil9-10

Hi @kapil9-10,

good to know it helped you.

I don't know if there's an event to capture the scroll, but the click is get on the dateChange event. So, as I explained in the last post, when you click on 'OK', it will get the value that you have set. Otherwise, if you click 'Cancel', it will get the old value. So you can get the 'OK' click on dateChange event =)

Hope it helps!

giulianimartini avatar Aug 25 '20 22:08 giulianimartini