全日历日单击在更改月份之前不起作用



FullCalendar dayClick 在我的项目中不起作用,直到用户返回或提前一个月,然后回到当前月份。我继承了这个项目,以前没有日历功能的经验,所以我不确定从哪里开始,除了发布与其中一个日历关联的标记。我是StackOverflow的新手,所以如果我需要发布任何其他细节,请告诉我。提前感谢您的任何建议。

<%@ Control Language="C#" AutoEventWireup="true" CodeFile="PersonalCalendar.ascx.cs" Inherits="Controls_Events_PersonalCalendar" %>
<link id="lnkCSSFiles" type="text/css" media="screen, projection" rel="stylesheet" href="~/css/fullcalendar.css" runat="server" />
<div class="rightCol">
    <div class="search masked formWhole">
        <label for="searchBox">
            Search</label>
        <asp:TextBox ID="txtSearch" CssClass="text" runat="server" />
        <asp:Button ID="btnSearch" CssClass="button" Text="Search" OnClick="btnSearch_Click"
            runat="server" />
    </div>
</div>
<div>
    <asp:ListView ID="lsvSearch" runat="server">
        <LayoutTemplate>
            <h3>
                Search Results</h3>
            <asp:PlaceHolder ID="itemPlaceHolder" runat="server" />
        </LayoutTemplate>
        <ItemTemplate>
            <div class="eventList">
                <a href="<%#((EventsWrapper)Container.DataItem).URL %>" class="eventTitle">
                    <%# ((EventsWrapper)Container.DataItem).Title%></a> <span class="eventDate">
                        <%# ((EventsWrapper)Container.DataItem).StartDate%></span> <span class="eventLocation">
                            in
                            <%# ((EventsWrapper)Container.DataItem).City%></span> <a class="more" href="<%#((EventsWrapper)Container.DataItem).URL %>">
                                View Event &raquo;</a>
            </div>
        </ItemTemplate>
    </asp:ListView>
</div>
<div id="genWidget" class="calendarWidget" runat="server">
    <div id="calendar"> 
    </div>
</div>
<!--end Calendar Widget-->
<asp:Literal ID="litJavaScripts" Text="~/tft-js/core/fullcalendar.js,~/tft-js/core/jquery.dateformat.js,~/tft-js/jquery.tools.min.js" runat="server" />
<script type="text/javascript">
    function outputAMPM(d) {
            var date = new Date(d);
            h = d.getHours();
            if (h < 12)
                return "AM";
            return "PM";
        }
    $(document).ready(function () {
        $("#calendar").fullCalendar({
            <% if (m_Year.HasValue){ %>year: <%= m_Year.Value %>,<%} %>
            <% if (m_Month.HasValue){ %>month: <%= m_Month.Value - 1 %>,<%} %>
            events: '<%= ResolveClientUrl(Request.AppRelativeCurrentExecutionFilePath) + (!String.IsNullOrEmpty(Request.QueryString.ToString()) ? "?" + Request.QueryString.ToString() : "") %>',
            header: {
                left: 'prev,next title',
                center: '',
                right: ''
            },
            aspectRatio: 1.1,
            titleLength: <%= TitleLength %>,
            weekSelectURL: '<%= ResolveClientUrl("~/events.aspx") + m_DaylessQueryString + (!String.IsNullOrEmpty(m_DaylessQueryString) ? "&" : "?") %>',
            weekMode: 'variable',
            timeFormat: 'H(:mm)', 
            eventRender: function(event, element) {
                element.append('<div class="eventPopup"><div class="popupWrapper"><span class="title">'+ event.title + '</span><span>' + $.format.date(event.start, "MM/dd/yyyy hh:mm") + outputAMPM(event.start) + '</span><span class="address">' + event.Address1+ '<br />' + event.Address2+ '<br />' + event.City + ', ' +event.State +' ' + event.Zip + '</span>' + '<a class="more" href="'+event.url +'">'+event.url +'</a><a class="more" href="all-events.aspx">View More</a><div class="clearfix"><div class="addthis_toolbox"><a class="addthis_button_facebook" addthis:url="'+ event.url +'" addthis:title="'+ event.title + '"></a><a class="addthis_button_tweet" tw:count="none"></a><a class="addthis_button_google_plusone" <%= "g:plusone:count="false"" %>></a></div></div></div></div>');
            },
      eventAfterRender: function(event, element,view){
       setTimeout(function(){
        $('div.fc-event > a').tooltip().dynamic();
                $('div.fc-event').hover(function() {
                        $(this).addClass('hoveredEvent');
                    },
                    function() {
                        $(this).removeClass('hoveredEvent');
                    }
                );
       },1000);
      }
        });
        $(".fc-day-number").each(function(){
            var num = $(this).find("a").html();
            $(this).html(num);
        });
    });
</script>
<script type="text/javascript">
</script>
<script type="text/javascript" src="http://s7.addthis.com/js/300/addthis_widget.js#pubid=ra-5098045873d5139d"></script>

我在使用它时遇到了这个问题。这是由于代码不是用$(document).ready(function(){}编写的)。既然你已经这样做了,请尝试指定一个默认视图。到它。如果可能,请创建一个 http://www.jsfiddle.net

相关内容

  • 没有找到相关文章

最新更新