2017-04-08 1 views
0

DHTMLX 컨트롤 이벤트 스케줄러에서 텍스트/배경에 다른 색상을 표시하려고합니다. 그래서 내 코드는 그냥 더미 데이터를 전달하는 것입니다 -DHTMLX 컨트롤 이벤트 스케줄러에서 텍스트 색상 및 배경을 설정하는 방법

public ActionResult Index() 
     { 
      var scheduler = new DHXScheduler(this); 
      scheduler.Skin = DHXScheduler.Skins.Flat; 
      scheduler.Config.multi_day = true; 
      scheduler.InitialDate = new DateTime(DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day); 
      scheduler.LoadData = true; 
      scheduler.EnableDataprocessor = true; 
      return View(scheduler); 
     } 


    public ContentResult Data() 
     { 
      var data = new SchedulerAjaxData(
       new List<CalendarEvent>{ 
        new CalendarEvent{ 
         id = 1, 
         text = "Sample Event", 
         start_date = new DateTime(2017, 04, 09, 3, 00, 00), 
         end_date = new DateTime(2017, 04, 09, 4, 00, 00) 

        }, 
        new CalendarEvent{ 
         id = 2, 
         text = "Event Anniversery", 
         start_date = new DateTime(2017, 04, 08, 6, 00, 00), 
         end_date = new DateTime(2017, 04, 08, 8, 00, 00) 
        }, 
        new CalendarEvent{ 
         id = 3, 
         text = "Third Event", 
         start_date = new DateTime(2017, 04, 07, 8, 00, 00), 
         end_date = new DateTime(2017, 04, 07, 9, 00, 00) 
        } 
       } 
      ); 
      return (ContentResult)data; 
     } 

도와주세요. Google에서 어떤 결과도 찾지 못했습니다.

답변

0

이 기사를 확인하셨습니까? http://scheduler-net.com/docs/custom-color.html? 한마디로

을 수행 할 수 있습니다 이벤트 객체의 속성 중 하나를 저장 색상 :

public class Event 
{ 
    public int id { get; set; } 
    public string text { get; set; } 
    public DateTime? start_date { get; set; } 
    public DateTime? end_date { get; set; } 
    public string color { get; set; } 
    public string textColor { get; set; } 
} 

데이터 :

new CalendarEvent{ 
    id = 1, 
    text = "Sample Event", 
    start_date = new DateTime(2017, 04, 09, 3, 00, 00), 
    end_date = new DateTime(2017, 04, 09, 4, 00, 00), 
    color = "#FF0000", 
    textColor = "#FFFFFF" 
} 

아니면 다른 속성을 기준으로 이벤트 요소에 CSS 클래스를 첨부 할 수 있습니다

자바 스크립트 :

scheduler.templates.event_class = function(start, end, event){ 
    if(event.someProperty){ 
     return "colored-event"; 
    } 
    return ""; 
}; 

CSS :

/*event in day or week view*/ 
.dhx_cal_event.colored-event div{ 
    background-color: #FF0000 !important; 
    color: #FFFFFF !important; 
} 

/*multi-day event in month view*/ 
.dhx_cal_event_line.colored-event{ 
    background-color: #FF0000 !important; 
    color: #FFFFFF !important; 
} 

/*single-day event in month view*/ 
.dhx_cal_event_clear.colored-event{ 
    color: #FF0000 !important; 
} 
관련 문제