uxsolutions / bootstrap-datepicker

A datepicker for twitter bootstrap (@twbs)
Apache License 2.0
12.68k stars 6.06k forks source link

Extend plugin in order to overwrite the place function #2131

Open stevenbriscoeca opened 7 years ago

stevenbriscoeca commented 7 years ago

Anyway possible to extend the datepicker plugin to overwrite the place function? https://github.com/uxsolutions/bootstrap-datepicker/blob/master/dist/js/bootstrap-datepicker.js#L650

I want to be able to change the value of var left wihtout changing the plugin directly. https://github.com/uxsolutions/bootstrap-datepicker/blob/master/dist/js/bootstrap-datepicker.js#L670

Any help on this would be appreciated

stevenbriscoeca commented 7 years ago

I figured it out :

 $.fn.datepicker.Constructor.prototype.place = function() {
   console.log("overwritten");
 }
Azaret commented 7 years ago

If I may, why do you want to override the left variable?

stevenbriscoeca commented 7 years ago

I wanted to place the calendar in a different spot then the default : image

Correct me if I am wrong, but I don't think there is any other way to change the placement of the calendar.

Azaret commented 7 years ago

This is the orientation option maybe.

stevenbriscoeca commented 7 years ago

@Azaret I agree 100%, we extended because we wanted to work when you click on the button making it so that the popup is aligned with that button and not the input.

I hope that clarifies the reasoning behing extending the plugin