?
avatar chmst
chmst
12 Apr 2017

In an Application where the Calendar is used in the frontend, I replace Data via Ajax.
This requires inizialisation of the calendar in js.
It works fine in 3.6, but not in 3.7 because the name and params have changed.

avatar chmst chmst - open - 12 Apr 2017
avatar joomla-cms-bot joomla-cms-bot - labeled - 12 Apr 2017
avatar zero-24
zero-24 - comment - 12 Apr 2017

@dgt41 can you take a look here?

avatar joomla-cms-bot joomla-cms-bot - edited - 12 Apr 2017
avatar franz-wohlkoenig franz-wohlkoenig - change - 12 Apr 2017
Category JavaScript
avatar dgt41
dgt41 - comment - 12 Apr 2017

@chmst can you create a codepen with the code you are using?

avatar chmst
chmst - comment - 12 Apr 2017
avatar zero-24 zero-24 - change - 13 Apr 2017
Labels Added: ?
avatar zero-24 zero-24 - labeled - 13 Apr 2017
avatar wilsonge
wilsonge - comment - 18 Apr 2017

@dgt41 any updates on your side here?

avatar dgt41
dgt41 - comment - 18 Apr 2017

Nope
@chmst can you provide some more info here?
like do you initiate the calendar with JHtml?
What options are you using?

One simple way to force initialising the calendar on the success of your javascript is to

  • have a dummy class in the dom Loaded e.g. .field-unused-calendar
  • on success execute JoomlaCalendar.init(".field-unused-calendar");

Or you can replicate what @Fedik is doing for the subforms: https://github.com/joomla/joomla-cms/blob/staging/media/system/js/fields/calendar.js#L1127-L1129

Joomla doesn't have control over the javascript events so we need to improvise here :(

@wilsonge I don't see we can do something more here

avatar bembelimen
bembelimen - comment - 18 Apr 2017
  1. Create a JForm XML file with a calendar field
  2. Output the calendar field (=> The calendar JS will be initialized)
  3. now inject a complete jform calendar field html into your document
  4. initialize the calendar via JS code (=> see @chmst code)

The 3.6.5 code does not work in 3.7 anymore

avatar dgt41
dgt41 - comment - 18 Apr 2017

@bembelimen the calendar initialises itself on the event 'DOMContentLoaded', @chmst 's code will not work as there's no setup function anymore...

avatar bembelimen
bembelimen - comment - 18 Apr 2017

as I said, the first input field is initialized, but the second have to be initialized manually, because it's injected after dom loaded

avatar franz-wohlkoenig franz-wohlkoenig - change - 22 Apr 2017
Status New Discussion
avatar zero-24
zero-24 - comment - 23 Apr 2017

Closing as there is a PR by @dgt41 #15487 Please test there!

avatar zero-24 zero-24 - change - 23 Apr 2017
Status Discussion Closed
Closed_Date 0000-00-00 00:00:00 2017-04-23 12:49:00
Closed_By zero-24
avatar zero-24 zero-24 - close - 23 Apr 2017
avatar zero-24 zero-24 - change - 16 Oct 2017
Labels Removed: ?
avatar zero-24 zero-24 - unlabeled - 16 Oct 2017

Add a Comment

Login with GitHub to post a comment