Gardezi
Gardezi

Reputation: 2842

Add a button in Full Calendar

Hello guys I'm using full calendar for calendar in a couple of my modules. In one module I have a requirement that the clients wants to add a button with the today and the left right button. Now one way to do is to customize the plugin but then I will have to add another file of full calendar for the other modules which is not good. So can you guys please tell me how can I accomplish this feature.

Here is what I'm trying to do: screencast.com/t/wbCSlBwgsSRU

and the HTML of the button is : <div class="padding-left-30"> <a href="<?= base_url()?>apps/calendar/calendarShow" class="btn btn-primary" > Details </a></div>

It would be a great help

Upvotes: 1

Views: 5102

Answers (2)

Gardezi
Gardezi

Reputation: 2842

Hello guys I was able to find the answer to my question. Now what I did was I placed the button as @Mottie told me to do in his answer and then inside that buttons js I used window.location.href and gave the url to it. Now I do not know if it's correct or not but this solution worked for me smoothly

Upvotes: 0

Mottie
Mottie

Reputation: 86473

No extra modules are required. Use the customButtons option to add another button to the header (demo)

$(function() {
  $('#calendar').fullCalendar({
    header: {
      left: 'prev,next, today, details',
      center: 'title',
      right: 'month,agendaWeek,agendaDay'
    },
    customButtons: {
      details: {
        text: 'Details',
        click: function() {
          alert('Show details!');
        }
      }
    }
  });
});

Upvotes: 3

Related Questions