Primefaces schedule button component

UI Components for JSF
Post Reply
PrimefacesFighter
Posts: 6
Joined: 15 Sep 2017, 09:04

19 Sep 2017, 09:33

Hi all,
I have a problem regarding primefaces schedule component buttons like the prev, next and also current date button. Can I put any function for the action of these buttons to get any value and also call another action?

Code: Select all

function setSelectedFullDayBackground(selectedDate)
        {
            var weekendDate = new Date(selectedDate);
            $('td[data-date="' + weekendDate.toISOString().substr(0, 10) + '"]').addClass('fullDayBackground');
        }
I need a way to call this javascript method and the primefaces schedule component button. I found some way to working with this, however when I try to use it, it did not working.

Code: Select all

$('.fc-next-button').click(function () {
            console.info('test next');
        });

$('.fc-prev-button').click(function () {
            console.info('test prev');
        });
The console.info did not show at the browser. Can anyone help me to find another idea to working with these buttons?

Thanks
Primefaces 6.1

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

19 Sep 2017, 13:36

You need to use the newer Jquery syntax..

Code: Select all

$('.fc-next-button').on('click', function () {
            console.info('test next');
});
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

PrimefacesFighter
Posts: 6
Joined: 15 Sep 2017, 09:04

20 Sep 2017, 03:10

This one also cannot, but thanks for your help..
Primefaces 6.1

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

20 Sep 2017, 13:33

I tested this in the showcase. To test do this..

1. Navigate to this page... https://www.primefaces.org/showcase/ui/ ... dule.xhtml

2. Press F12 in Google Chrome to bring up the console.

3. In the console copy and paste this exactly and press ENTER

Code: Select all

$('.fc-next-button').on('click', function () {
            console.info('test next');
});
4. Now press the next button on the Schedule. You will see "test next" printed in the console because your method is now attached.
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

PrimefacesFighter
Posts: 6
Joined: 15 Sep 2017, 09:04

21 Sep 2017, 03:23

Ok thanks for your help! maybe my jquery version is not updated..... :( :(
Primefaces 6.1

kukeltje
Expert Member
Posts: 9605
Joined: 17 Jun 2010, 13:34
Location: Netherlands

21 Sep 2017, 09:09

No, this syntax should work even for PrimeFaces versions back to 3.5 (cannot check for earlier versions easily). So you most likely have a different problem then, not visible from your code/question.

Post Reply

Return to “PrimeFaces”

  • Information
  • Who is online

    Users browsing this forum: No registered users and 78 guests