Datepicker: onMonthChange event

UI Components for JSF
Post Reply
majulvez
Posts: 14
Joined: 26 Jan 2017, 17:16

20 Feb 2019, 19:31

Hi,

i've seen in the original js component (https://www.primefaces.org/primeng/#/calendar) the event 'onMonthChange'.

How can I use the event onMonthChange in the new jsf primefaces datepicker?

Thanks
Best regards

Melloware
Posts: 3717
Joined: 22 Apr 2013, 15:48

20 Feb 2019, 19:49

I think you will have to request it on Github. I don't see any "on" method for client side JS callbacks.
PrimeFaces Developer | PrimeFaces Extensions Developer
GitHub Profile: https://github.com/melloware
PrimeFaces Elite 13.0.0 / PF Extensions 13.0.0
PrimeReact 9.6.1

majulvez
Posts: 14
Joined: 26 Jan 2017, 17:16

21 Feb 2019, 10:51

I was thinking in use the javascript options of the componet.

For instance, in calendar I can use this code in order to register a new function for an event which hasn't callback

PF('widgetNameCalendar').jqEl.datetimepicker('option', 'onClose', function(){console.log('closed')})

I tried

PF('widgetNameDatePicker').jqEl.datePicker('option', 'onMonthChange', function(){console.log('month changed')})

but I get this javascript error

Uncaught Error: cannot call methods on datePicker prior to initialization; attempted to call method 'option'

Best regards

Melloware
Posts: 3717
Joined: 22 Apr 2013, 15:48

21 Feb 2019, 14:32

Yep the DatePicker is a completely new JS component written from the ground up. The Calendar component is based on JQuery UI DatePicker widget. I think you will have to request this enhancement here: https://github.com/primefaces/primefaces/issues
PrimeFaces Developer | PrimeFaces Extensions Developer
GitHub Profile: https://github.com/melloware
PrimeFaces Elite 13.0.0 / PF Extensions 13.0.0
PrimeReact 9.6.1


sarath28pk
Posts: 1
Joined: 20 May 2020, 19:39

20 May 2020, 19:47

onMonthChange event and onYearChange event is also triggering the normal html (change) event.
but the date value also not changed..

Better to do an event.prevent default before emitting this event

Post Reply

Return to “PrimeFaces”

  • Information
  • Who is online

    Users browsing this forum: No registered users and 26 guests