2011-10-17 19 views
0

Kevin LuckのJQuery日付ピッカープラグインに関する質問があります。Kevin LuckのJQuery日付ピッカープラグイン - 日付間隔でカレンダーを表示し、カスタム日を強調表示します

カレンダーを から選択した日付(例:01/01/1990から2015/01/01)にレンダリングすることはできますか? そしてカスタム日を強調したい(cssクラス.selectedを設定する)。 たとえば、次の日を選択します。

01/06/1990 | 09/02/1995 | 10/03/2005 | 11/01/2007 | 06/07/2010 |

私はこれを達成するためにいくつかのコードを書こうとしましたが、それでもいいです。

$(function(){ 

     var testCallback = function($td,thisDate, year, month,day) 
     { 
      // some implementation here 


      return true; 
     } 


     $('#calendar') 
      .renderCalendar({renderCallback:testCallback})   
      .datePicker(
       { 
        inline:true, 
        selectMultiple:false, 
        startDate:'01/01/1990' 
       })    
      .bind(
      'dateSelected', 
      function(e, selectedDate, $td) 
      { 
       date = selectedDate.asString(); 

       date = date.split(/\//); 

       getStuffByAjax(date[2],date[1],date[0]); 
      } 
     ); 

}); 

function getStuffByAjax(year,month,day){ 
    // some implementation here 

    return true;   
} 

私はrenderCallback機能を使用する場合、私は今年の だけ1ヶ月でレンダリングされたカレンダーを取得します。

アイデア?

ご協力いただきありがとうございます。

答えて

0

私は私の質問に答えます。だから私がしなければならなかったすべては、日付ピッカーメソッドにrenderCallBack機能 を置くことです:

// JavaScript Document 

$(function(){    
     $('#calendar')  
      .datePicker(
       { 
        inline:true, 
        selectMultiple:false, 
        startDate:'01/01/1990', 
        renderCallback:function($td, thisDate, month, year) 
        { 

         if(thisDate.getDate() == 10){ 
          $td.addClass('selected'); 
         } 



        } 
       })    
      .bind(
      'dateSelected', 
      function(e, selectedDate, $td) 
      { 
       date = selectedDate.asString(); 

       date = date.split(/\//); 

       getStuffByAjax(date[2],date[1],date[0]); 
      } 
     ); 

}); 

function getStuffByAjax(year,month,day){ 
    // some implementation here 

    return true;   
} 

今、すべては私が望んでいたように動作します。乾杯。

関連する問題