2011-04-12 2 views
7

내 응용 프로그램에서 JQuery 전체 일정을 사용하고 있는데 약간 다른보기가 필요합니다. 즉, 월보기에서 다른 일정과 관련된 일정이있는 일만 표시됩니다. 이벤트가없는 날보다 색이 깁니다. 그런 다음 사용자가이 날을 월간보기로 클릭하면이 날의 하루보기가 열리고 모든 이벤트가 표시됩니다.JQuery 전체 일정,보기를 변경하는 방법

조정할 수 있습니까? 친절하게 감사드립니다. 대신 (이벤트를보고 경고를 위해 클릭 3 월로 이동) 것을 원한다면

답변

7

내가 두 피드

내 서버가 반환

를 사용하여 이런 짓을했는지 feedBasic feedComplex

feedBasic은 같은 이벤트가 몇 개라도 상관없이 한 달에 하나의 이벤트 만 표시합니다. 클릭하면 월간보기로 변경되고 전체 피드가로드됩니다.

이 코드가 도움이 될 수 있습니다. 그것은 코드의 할당이지만 4 피드 + 구글 캘린더를 처리합니다. 몇 가지 버그가 있지만 작동하는 핵심 기능이 있습니다.

$(document).ready(function() { 

     var lastView; 

     $('#calendar').fullCalendar({ 
      header: { 
       left: 'today', 
       center: 'prev,title,next', 
       right: 'month,basicDay' 
      }, 
      slotMinutes: 30, 
      firstHour: 5, 
      editable: false, 
      timeFormat: 'H:mm', 
      firstday: 0, //Sunday0 Monday1..etc 
      allDayDefault : true, 
      //loading: function(bool) { if (bool) $('#loadingImg').show(); else $('#loadingImg').hide(); alert($('#calendar').fullCalendar('clientEvents')) }, 

      loading: function(bool) { if (bool) $('#loadingImg').show(); else $('#loadingImg').hide(); }, 

      //VIEW CHANGE - ALSO ADDS INITIAL SOURCES PER DAY VIEW 
      viewDisplay: function(view) { 
             if (lastView == undefined) { lastView = 'firstRun'; } 

             if (view.name != lastView) 
             { 

               if (view.name == 'month') 
                { 
                if ('<%=brsEnabled %>' == 'True') { $('#calendar').fullCalendar('removeEventSource', '/diaryFeed.aspx?style=brsComplex'); $('#calendar').fullCalendar('addEventSource', '/diaryFeed.aspx?style=brsBasic');  } 
                if ('<%=activeEnabled %>' == 'True') { $('#calendar').fullCalendar('removeEventSource', '/diaryFeed.aspx?style=fixturesComplex'); $('#calendar').fullCalendar('addEventSource', '/diaryFeed.aspx?style=fixturesBasic'); } 
                if ('<%=previousEnabled %>' == 'True') { $('#calendar').fullCalendar('removeEventSource', '/diaryFeed.aspx?style=previousComplex'); $('#calendar').fullCalendar('addEventSource', '/diaryFeed.aspx?style=previousBasic'); } 
                if ('<%=newsEventEnabled %>' == 'True') { $('#calendar').fullCalendar('removeEventSource', '/diaryFeed.aspx?style=newsEvents'); $('#calendar').fullCalendar('addEventSource', '/diaryFeed.aspx?style=newsEvents'); } 
                } 
               if (view.name == 'basicDay') 
                { 
                if ('<%=brsEnabled %>' == 'True') { $('#calendar').fullCalendar('removeEventSource', '/diaryFeed.aspx?style=brsBasic'); $('#calendar').fullCalendar('addEventSource', '/diaryFeed.aspx?style=brsComplex'); } 
                if ('<%=activeEnabled %>' == 'True') { $('#calendar').fullCalendar('removeEventSource', '/diaryFeed.aspx?style=fixturesBasic'); $('#calendar').fullCalendar('addEventSource', '/diaryFeed.aspx?style=fixturesComplex'); } 
                if ('<%=previousEnabled %>' == 'True') { $('#calendar').fullCalendar('removeEventSource', '/diaryFeed.aspx?style=previousBasic'); $('#calendar').fullCalendar('addEventSource', '/diaryFeed.aspx?style=previousComplex'); } 
                if ('<%=newsEventEnabled %>' == 'True') { $('#calendar').fullCalendar('removeEventSource', '/diaryFeed.aspx?style=newsEvents'); $('#calendar').fullCalendar('addEventSource', '/diaryFeed.aspx?style=newsEvents'); } 
                } 

             lastView = view.name; 
             } 
            }, 

      //EVENT CLICK 
      eventClick: function(event, jsEvent, view) 
      { 
       //STOP GOOGLE LINK FROM FOLLOWING THROUGH ON ALL OCCASIONS 
       if (event.url != undefined) { if (event.url.indexOf("google") > 0) { return false; } } 

       if (event.newsEvent == "True") 
        { 
         //SOME OTHER SPECIFIC FUNCTION 
        } 
        else 
        { 
         var view = $('#calendar').fullCalendar('getView'); 
         if (view.name == 'month') 
         { 
          $('#calendar').fullCalendar('changeView', 'basicDay'); 
          $('#calendar').fullCalendar('gotoDate', event.start); 
         } 
         if (view.name == 'basicDay') 
         { 
          //HANDLES CLICK OF EVENT IN DAY VIEW TO EXPAND DIV WITH EXTRA INFORMATION 

         } 
        } 
      }, 

      //HOVER 
      //eventMouseover: function(event, jsEvent, view) { if (event.PopUp == 'yes') { $(this).CreateBubblePopup({ innerHtml: + '<br/>Click for more infromation.' , themePath: 'images/bubblepopup-theme', themeName: 'black' }); } } , 

      //DAY CLICK 
      //dayClick: function(event, jsEvent, view) { alert("Day Clicked.. Booking?") } , 

      //ALL COMBINED INITIAL FEEDS 
      eventSources: [ <%=myGoogleCalendars %> ] 

     }); 

     //ATTACHING A LOADING IMAGE 
     $('.fc-header-title').append('<img id="loadingImg" style="width:16px; height:11px; float:none; margin-top: -25px;" src="images/loadingSmall.gif" />'); 

     //HDID FILTER 
     if ('<%=activeEnabled %>' == 'True') { 

     $('.fc-header-left').append('<span class="fc-button fc-button-today fc-state-default fc-corner-left fc-corner-right fc-state-active"><span class="fc-button-inner"><span id="filterHDID" class="fc-button-content">hdid</span><span class="fc-button-effect"><span></span></span></span></span>'); 
     $("#filterHDID").click(function() { if ($(this).parents('span').hasClass('fc-state-active')) 
      { 
       $('.data-fixtures').css('display', 'none') 
       $(this).parents('span').removeClass('fc-state-active'); 
       if ('<%=previousEnabled %>' == 'True') { $('.data-previous').css('display', 'none'); 
                 } 
      } 
      else 
      { 
       $('.data-fixtures').css('display', 'inline') 
       $(this).parents('span').addClass('fc-state-active'); 
       if ('<%=previousEnabled %>' == 'True') { $('.data-previous').css('display', 'inline') 
                 } 
       }    }); 
     } 


     //BRS FILTER 
     if ('<%=brsEnabled %>' == 'True') { 

     $('.fc-header-left').append('<span class="fc-button fc-button-today fc-state-default fc-corner-left fc-corner-right fc-state-active"><span class="fc-button-inner"><span id="filterBRS" class="fc-button-content">brs</span><span class="fc-button-effect"><span></span></span></span></span>'); 
     $("#filterBRS").click(function() { if ($(this).parents('span').hasClass('fc-state-active')) 
      { 
       $('.data-brs').css('display', 'none') 
       //$('#calendar').fullCalendar('removeEventSource', '/diaryFeed.aspx?style=brs'); 
       $(this).parents('span').removeClass('fc-state-active'); 
      } 
      else 
      { 
       $('.data-brs').css('display', 'inline') 
       //$('#calendar').fullCalendar('addEventSource', '/diaryFeed.aspx?style=brs'); 
       $(this).parents('span').addClass('fc-state-active'); 
       }    }); 
     } 

     //GOOGLE FEED FILTER 
     if ('<%=googleEnabled %>' == 'True') { 

      $('.fc-header-left').append('<span class="fc-button fc-button-today fc-state-default fc-corner-left fc-corner-right fc-state-active"><span class="fc-button-inner"><span id="filterGCAL" class="fc-button-content">google</span><span class="fc-button-effect"><span></span></span></span></span>'); 
      $("#filterGCAL").click(function() { if ($(this).parents('span').hasClass('fc-state-active')) 
      { 
       $('#calendar').fullCalendar('removeEventSource', <%=myGoogleCalendars%>); $(this).parents('span').removeClass('fc-state-active'); 
      } 
      else 
      { 
       $('#calendar').fullCalendar('addEventSource', <%= myGoogleCalendars%>); $(this).parents('span').addClass('fc-state-active'); 
       }    }); 
     } 

     //MORE 



    }); 
</script> 

일어날 것으로 예상되는 동영상입니다. 필요한 방식으로 연결하십시오. http://www.youtube.com/watch?v=UKUu9KJxunI

+0

를 클릭하여 첫 번째보기에 나타납니다 removeEventSource 전에 addEventSource를 읽어들이는 데 필요한 . 특히 귀하의 버튼 즉, BRS/Google 등. 버튼을 클릭하면 상세 또는 간단한 데이터 세트를로드하는 사용자를 전환하는 데 사용할 수 있습니다. 또한 큰 문제로 나를 도왔습니다. 달/일/주로드 여부에 따라 다른 데이터 피드 세부 정보를로드하는 방법을 알아낼 수 없습니다. 나는 필요했다'viewDisplay : function (view) { \t alert (view.name); \t}'그것은 문서 전체에서 옳았습니다! – wired00

+0

그냥 달력에 처음으로로드 한 다음 month 또는 basicDay보기를 클릭 할 때 명확한 설명을 원한다면 중복 레코드가 보입니까? 정확히 (if (view.name! = lastView)'등)에 관한 코드를 구현했지만이 문제를 해결할 수는 없습니다. – wired00

0

여기서보기간에 이동하면 생성 된 중복없이 작동하는 솔루션입니다. 로드하는보기에 따라 두 개의 서로 다른 데이터 소스 세트를로드합니다. 나는 ppumkins와 그의 도움을 사용했다. addEventSourceremoveEventSource 호출 순서에 유의하십시오. 나를 위해 내가 그렇지 않으면 중복 나는 내가 fullcalendar 내 구현에서 사용할 수있는 코드에 많이 있다고 생각 즐겨 찾기로이를 추가 한

http://dev2.mycmo.com.au/fullcalendar/calendar_problem_demo.php

관련 문제