Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
316 views
in Technique[技术] by (71.8m points)

php - showing both weekdays and weekends on the same fullcalendar

I want to show both all days of the week and weekdays as well on the same full calendar.i want to have two button on the calendar one called as "week" which is already on the full calendar which show all day of the week and other button called as "workweek" which will show me only weekends after clicking on it. suggest me for the same.

Here is my code

<script type='text/javascript'>
$(function() { 
  var date = new Date(); 
  var d = date.getDate(); 
  var m = date.getMonth(); 
  var y = date.getFullYear(); 
  var calendar = $('#calendar').fullCalendar({ 
    header: { 
      left: 'prev,next today', 
      center: 'title', 
       right: 'agendaDay,agendaWeek,month' 
    }, 
    selectable: true, 
    selectHelper: true, 
    weekends:false, 
    defaultView: 'agendaWeek', 
    select: function(start, end, allDay) { //calendar.fullCalendar('unselect'); 
    },
    editable: true 
   }); 
 }); 
</script
See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

Duplicate of FullCalendar switch between weekends and no weekends

so this answer only works if you remove the previous copy of the calendar from the DOM

http://arshaw.com/fullcalendar/docs/usage/

HTML:

<input type="button" id="weekends" value="Include weekends" />
<input type="button" id="workweek" value="Exclude weekends" />

JavaScript

$(function() {
  $("#weekends").on("click",function() {
    $('#calendar').fullCalendar({weekends:true});
  });
  $("#workweek").on("click",function() {
    $('#calendar').fullCalendar({weekends:false});
  });
});

to test my suggestion try pasting this

javascript:(function() {$('#calendar').fullCalendar({weekends:false})})()

into the location bar on this page and press enter (in Fx 15+ use the console or create a bookmark)

http://arshaw.com/js/fullcalendar-1.5.4/demos/external-dragging.html


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...