繁体   English   中英

当可观察到的基因敲除值发生变化时如何刷新提示

[英]how to refresh cluetip when value of knockout observable changes

如何更改提示中的内容。

 $('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的点击上调用时。

当我单击日历时,我在其中显示日历和待办事项列表,然后更改ko.observable()

我只想当ko.observable的值更改时,应刷新提示框,但应保留单击的日历,只是待办事项列表应根据该日期刷新。

<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)该值在运行时随着具有新数据的功能警报而变化,但是cluetip仍然与单击cal_box时所初始化的相同它重新初始化,或者您说再次在cal_box上滑动,但是我没有这样做。

最好的方法是使用更新功能创建自定义绑定,您将可以同时访问元素和可观察元素,因此可以从那里更新提示。 每次值更改时,更新功能都会触发。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM