Skip to content
This repository was archived by the owner on Mar 24, 2022. It is now read-only.

Conversation

@mehernosh
Copy link

Used jQuery.removeData instead of delete to allow re-initialisation of the datetime picker for the same element.

I ran into a problem where I was unable to re-initialise a picker after destroying it. The delete keyword leaves the data in a weird state. Instead, if we use removeData, it works fine.

… the datetime picker for the same element.
@pimounet
Copy link

Hi,
I modified js/bootstrap-material-datetimepicker.js as explained.
Destroy seems to work BUT...

I use the picker in french format (DD/MM/YYY).
After Destroy and re-init, the date format stays YYYY/MM/DD and the language in EN !!!???
(I need to re-init to change time from false to true or true to false depending on user choice)
Do I forget something or is it a result of jQuery.removeData?
Thanks for your help and your work on this helpful package

$(".myDatepicker").bootstrapMaterialDatePicker('destroy');
$(".myDatepicker").bootstrapMaterialDatePicker({ 
			format : 'DD/MM/YYYY', 
			time: false,
			lang : 'fr', 
			weekStart : 1, 
			okText : 'Ok', 
			cancelText : 'Annuler', 
			switchOnClick : true 
		});

@plasebo
Copy link

plasebo commented Sep 5, 2017

I ran through the same issue whereby the timepicker was set to false initially but after destroy the timepicker appears.

I ran through the main js to set the default values of the params part setting the time: false etc...

For your issue, I suggest setting the lang to fr by default in the main js

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants