0

手がかりのヒントの内容を変更する方法。

 $('a.cal_box').cluetip({local:true, hideLocal: true ,onShow: function(ct, ci){ this.calendar = $('<div>').datepicker({ beforeShowDay: daysToMark,onSelect: function(dateText, inst) { 
  var date = $(this).datepicker( 'getDate' ); 
  //var c = ko.contextFor($("#KnockOutCalendar")[0]);
    calendarObject.$data.Date(date.getFullYear()+'-'+date.getMonth()+'-'+date.getDate());   
    calendarObject.$data.Time(date.getHours());
    //$('a.cal_box').cluetip({local:true,activation:'hover', hideLocal: true, sticky: true, arrows: true, cursor: 'pointer',width:970, height:530}); 
  } }).appendTo(ci); }, onHide: function(ct, ci){ this.calendar.datepicker( "destroy" ).remove(); }, sticky: true, arrows: true, cursor: 'pointer',width:970, height:530});

cal_box をクリックしてヒントが呼び出されたとき。

その中にカレンダーを表示し、カレンダーをクリックするとTo Doリストが表示されますko.observable()

ko.observable の値が変更されたときに手がかりボックスを更新する必要がありますが、クリックした場所のカレンダーは保持する必要があり、その日付に従って todo リストを更新する必要があります。

<div id="KnockOutCalendar" data-bind="foreach: {data:Calendar,afterRender: myPostProcessingLogic}">
             <!-- ko if: $parent.ChangeDate(dstart) == $parent.Date() -->
            <div class="timeline_row">

              <div class="timeline_row_heading" ><span data-bind="text: $parent.ChangeTime(dstart)"></span>:00</div>
              <div class="timeline_row_content showcalen_entry"><span data-bind="text: dstart"></span> - <span data-bind="text: subject"></span></div>

            </div>
            <!-- /ko -->
            </div>

このforeachでは、イベントに関するデータがある場合は日付を表示し、timeline_rowそれ以外の場合は空白にする必要があります

私が欲しいのは、日付をクリックしself.Date(clickedDate)て実行時に値を変更すると、新しいデータで機能アラートとして実行されますが、cal_box をクリックすると初期化されたときと同じままです。もう一度cal_boxをクリックしますが、私はそれをしていません。

4

1 に答える 1

0

Best way is to create a custom binding with a update function, you will have access to both the element and observable so you can update the cluetip from there. the update function triggers each time the value mutate.

于 2013-02-01T11:17:49.000 に答える