最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - FullCalendar - prevnext - Stack Overflow

programmeradmin1浏览0评论

I'm using Fullcalendar to display some events form json. That is all fine and I see them.

What I'm looking at doing though, is to reload the events based on the month.

So, I thought I could get the date based on what month I'm on from clicking Prev or Next.

I have the following is /

There is a strange occurrence when clicking back and forth getting incorrect months.

This is slightly worrying as the data needs to be accurate.

Does anyone have any ideas why this could be happening?

Thanks

I'm using Fullcalendar to display some events form json. That is all fine and I see them.

What I'm looking at doing though, is to reload the events based on the month.

So, I thought I could get the date based on what month I'm on from clicking Prev or Next.

I have the following is http://jsfiddle/6wE8v/408/

There is a strange occurrence when clicking back and forth getting incorrect months.

This is slightly worrying as the data needs to be accurate.

Does anyone have any ideas why this could be happening?

Thanks

Share Improve this question edited Dec 7, 2013 at 0:34 mcuadros 4,1443 gold badges39 silver badges45 bronze badges asked Dec 6, 2013 at 19:08 user789122user789122 4805 gold badges12 silver badges25 bronze badges 1
  • This link might be helpful. – Jhecht Commented Dec 17, 2016 at 5:54
Add a ment  | 

1 Answer 1

Reset to default 1

Your handler is being executed before the plugin has changed the month.

One way to solve this is to manually trigger the next/prev events yourself.

http://jsfiddle/6wE8v/408/

$('#calendar').fullCalendar(
{
  header: {
    left: 'prev,next today',
    center: 'title',
    right: 'month,agendaWeek,agendaDay'
  },
   editable: true,        
  }); 

  $('.fc-button-prev span').click(function(){
     var date1 = $('#calendar').fullCalendar('prev').fullCalendar( 'getDate' );
     alert('prev ' + date1.getMonth());
     return false;
  });

  $('.fc-button-next span').click(function(){
     var date1 = $('#calendar').fullCalendar('next').fullCalendar( 'getDate' );
     alert('next ' + date1.getMonth());
     return false;
  });
发布评论

评论列表(0)

  1. 暂无评论