1

我使用 jqueryfullcalander控件。我想在月视图中为假期着色。点击假期后打开有关假期的消息。
我使用事件将假期发送到日历。但它不工作任何人都可以帮助我

 $('#calendar').fullCalendar
         ({


             allEvent: {
                 titles: '.........',
                 start: '07/24/2012'
             },

             eventSources: [
             {
            url: '@Url.Action("LeaveCalandar")',
            type: 'Get',
           data{username:user},
           dataType:"JSON",
            success: function() {
                alert('there was an error while fetching events!');
            },
            color: 'yellow',   
            textColor: 'black' 
        }

        // any other sources...

    ],
             eventClick: function (calEvent, allDay) {
                 // $('#eventTitle').text(calEvent.title);
                 // alert(calEvent.title);
                 eventName = calEvent.title;
                 ShowDialog(eventName);
                 ShowDialog(calEvent.titles);

             },

这是我的事件日历操作方法

public JsonResult EventCalendarData(string username)
        {
        List<CalendarEvents> events = new List<CalendarEvents>();
        List<LeaveTransaction> leaveQuery;
        var query = (from sh in db.StatHolidays
                     select sh).ToList();
        if (!string.IsNullOrEmpty(username))
        {
             leaveQuery = db.LeaveTransactions
                .Where(lt=>lt.Employee.UserName.Contains(username))
                            .Select(lt => lt).ToList();
        }
        else
             leaveQuery = db.LeaveTransactions
                            .Select(lt => lt).ToList();

        foreach (var item in query)
        {
            events.Add(new CalendarEvents
                {
                    id = item.ID.ToString(),
                    title = item.Description,
                    start = ToUnixTimespan(item.DateofStatHoliday),
                    className = "custom",
                    allDay = true,
                });

        }
        foreach (var item in leaveQuery)
        {
            events.Add(new CalendarEvents
            {
                id = item.Id.ToString(),
                title = item.LeaveType.Type,
                start = ToUnixTimespan(item.StartDate),
                end =ToUnixTimespan(item.EndDate),
                className = "custom",
                allDay = true,
            });

        }

        return Json(events, JsonRequestBehavior.AllowGet);
    }
4

0 回答 0