full calendar background color selected disappear on prev/next button click

徘徊边缘 提交于 2019-12-12 04:32:54

问题


I have added some CSS classes in the day click event for giving some background color to the selected dates However, when a user clicks the prev, next, or today buttons, added classes are removed and previous color selected are lost.How can I retain the selected color even on button click

$('#calendar1').fullCalendar({
  locale: userlang,
  header: {
    left: 'prev,next today',
    center: 'title',
    right: 'month,basicWeek,basicDay'
  },

  dayClick: function(date, jsEvent, view) {
    debugger;

    alert('Clicked on: ' + date.format());
    component.set('v.selecteddate1', date.toISOString());

    console.log('selected val--->'+component.get("v.selecteddate"));
    //alert('Coordinates: ' + jsEvent.pageX + ',' + jsEvent.pageY);

    alert('Current view: ' + view.name);

    // change the day's background color just for fun
    $(this).css('background-color', 'orange');
  },

  editable: true,
  events: data,

  eventClick: function(event,jsEvent, view) {
    debugger;
    //alert(event.url);
    console.log('event url:'+event.url);
    console.log('event starttime:'+event.StartDateTime);
    //component.find("expdate1").set("v.selecteddate",event.StartDateTime);
    alert('test'+view.name);
    component.set()
  },

  eventMouseover: function(event, jsEvent, view) {
    $(jsEvent.target).attr('title', event.title+' '+'Hora de inicio:'+new Date(event.start).toDateString()+' Hora de finalización: '+new Date(event.end).toDateString());
  }
  //alert('Hello'+paramvalueget);
});

来源:https://stackoverflow.com/questions/45210292/full-calendar-background-color-selected-disappear-on-prev-next-button-click

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!