Skip to content
This repository has been archived by the owner on Jul 16, 2022. It is now read-only.

How to trigger in-build callbacks? #58

Closed
Nadoedalo opened this issue Feb 17, 2015 · 4 comments
Closed

How to trigger in-build callbacks? #58

Nadoedalo opened this issue Feb 17, 2015 · 4 comments

Comments

@Nadoedalo
Copy link

For example - I have multiple calendars, one visible at a time and I want to show only one field with inputs.

This is crucial because I have different callbacks for days and month selection.

@Nadoedalo
Copy link
Author

also the get_date function should return the origital Date object as second argument, as it is in callbacks.

@nazar-pc
Copy link
Owner

For example - I have multiple calendars, one visible at a time and I want to show only one field with inputs.

Which callbacks do you need? (try to inspect $('...').data('pickmeup-options') for methods you need)

This is crucial because I have different callbacks for days and month selection.

You can use $('...').data('pickmeup-options').view to check what are you selecting right now

also the get_date function should return the origital Date object as second argument, as it is in callbacks.

Which callbacks do you mean?

@Nadoedalo
Copy link
Author

initialize code :

this.$el.find('.switch_type .period').pickmeup({
                    flat        : true,
                    mode        : 'range',
                    calendars   : 3,
                    format : 'Y-m-d',
                    separator : '‐',
                    max : new Date(),
                    min : max_date, //you see - I can't do new Date().addYear(-10) because it will be undefined
                    change : this.changeDate.bind(this),
                    locale : locale
                });

I want to manually trigger that change callback WITH all data included.
Something like $('.pickmeup').pickmeup.('trigger', 'change') - and get my callback applied

@nazar-pc
Copy link
Owner

Try $('...').data('pickmeup-options').binded.update_date(), this is the method from which change event is called, also combination of get/set might work.

@nazar-pc nazar-pc closed this as completed Mar 5, 2015
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants