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

Common options for multiple datepickers #110

Closed
yarkm13 opened this issue Mar 6, 2018 · 3 comments
Closed

Common options for multiple datepickers #110

yarkm13 opened this issue Mar 6, 2018 · 3 comments

Comments

@yarkm13
Copy link

yarkm13 commented Mar 6, 2018

It would be nice if it will be possible to setup default options for all datepickers at page and then customize only some of them.

I have three datepickers on my page with cusom months and days names and i need to include it in all three .Zebra_DatePicker() calls or go throug ugly constructions as

common_options = {a: 1, b: 2};
date1_options = Object.assign({}, common_options, {c: 10});
date2_options = Object.assign({}, common_options, {c: 20});
date3_options = Object.assign({}, common_options, {c: 30});
@stefangabos
Copy link
Owner

I can't think of a better way than what you did there. It's how I would do it myself. I am open to suggestions though

@yarkm13
Copy link
Author

yarkm13 commented Jun 28, 2018

@stefangabos Zebra_Datepickerhame some default options now.

{direction: 0, default_position: "above"}

It's possible to create method to set that options globally for all future initialized datepickers.
E.g.

Zebra_Datepicker.defaults({direction: false, default_position: "below"});

and than

$('input.datepicker').Zebra_DatePicker();

will be initialized with custom set of default values ({direction: false, default_position: "below"})
or

$('input.datepicker').Zebra_DatePicker({direction: -10});

will be initialized with overriden value of direction: -10, and still cusom default value of default_position "below" but not the initial default "above"

Pretty simple solution as for me.

@stefangabos
Copy link
Owner

Please see the docs

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