Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Putting an icon on FullCalendar's header

I put a CustomButton on FullCalendar's header but i need to put an font-awesome icon.

           customButtons: {
                btnBloquearAgenda: {
                    icon: 'fa fa-lock',
                    click: function() {
                        alert('clicked the custom button!');
                    }
                }
            },

            header: {
                left: 'prev,next',
                center: 'title',
                right: 'btnBloquearAgenda agendaDay,agendaWeek,month'
            },

The button is showing "Undefined".

like image 850
Desenvolvimento ERP Avatar asked Oct 16 '25 14:10

Desenvolvimento ERP


1 Answers

The icon value is appended to 'fc-icon-' and added as a class to the button's span element, i.e.

            btnBloquearAgenda: {
                icon: 'fa fa-lock',
                click: function() {
                    alert('clicked the custom button!');
                }
            }

Would result in

<button type="button" class="fc-btnBloquearAgenda-button fc-button fc-state-default fc-corner-right">
<span class="fc-icon fc-icon-fa fa-lock"></span>
</button>

My work around was to just add an extra "fa" to the icon value

       customButtons: {
            btnBloquearAgenda: {
                icon: 'fa fa fa-lock',
                click: function() {
                    alert('clicked the custom button!');
                }
            }
        },

        header: {
            left: 'prev,next',
            center: 'title',
            right: 'btnBloquearAgenda agendaDay,agendaWeek,month'
        },

Result:

<button type="button" class="fc-btnBloquearAgenda-button fc-button fc-state-default fc-corner-right">
<span class="fc-icon fc-icon-fa fa fa-lock"></span>
</button>
like image 163
user3776999 Avatar answered Oct 19 '25 13:10

user3776999



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!