nehakadam / AnyPicker

jQuery Picker Library for Android, iOS & Windows Phone. eg Date Picker, Time Picker, DateTime Picker, Custom Select etc
https://nehakadam.github.io/AnyPicker/
MIT License
116 stars 37 forks source link

How to hook into Set and Cancel functions for the date/time picker? #12

Open shermmyy opened 8 years ago

shermmyy commented 8 years ago

I see the "inputSetEvent", which fires every time the date changes.

How do I hook into the Set and Cancel button actions?

nehakadam commented 8 years ago

Right now there is no separate callback function which is called on button click.

Following 4 callback functions can be used to capture show and hide events of the picker.

I can add that function, but should I add it before or after other code is executed? Do you have any specific requirement? Do you need any specific parameters in buttonClicked.

What I though was to add buttonClicked callback function after other code on that function is executed and function declaration would be buttonClicked(buttonType). Here buttonType can have values - "set", "clear", "cancel" or "now".

danielgasser commented 6 years ago

Maybe it would be good to have sOutput and oSelectedValues or similar parameters on the onHidePicker too. I'd like to be able to reset the date to it's initial state when user hits "Cancel".

Or maybe it'll be good to have a separate function like resetDate(sOutput, oSelectedValues) or something like that?

Your idea to have a buttonClicked with "set", "clear", "cancel" or "now" sounds good too.

Regards and many thanks for that handy plugin