简体   繁体   English

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

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

how to change whats inside the cluetip. 如何更改提示中的内容。

 $('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});

when the cluetip called on the click of cal_box. 当提示在cal_box的点击上调用时。

i show calendar in it and a to do list when i click on calendar i change the ko.observable() 当我单击日历时,我在其中显示日历和待办事项列表,然后更改ko.observable()

i just want when the value of ko.observable change it should refresh the cluetip box but should retain the calendar where it was click just the todo list should be refrsh according to that date. 我只想当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>

in this foreach i display date when there is data on the event on that if it there display the timeline_row else it should be blank 在此foreach中,当有事件数据时,我显示日期;如果有timeline_row ,则显示空白

what i want is when i click on a date and when it change the self.Date(clickedDate) the value changes on run time as the function alert with new data but cluetip remains the same as it was initialized when i click on cal_box i want it to reinitialized or you say again cliking on cal_box but i am not doing it. 我想要的是当我单击日期并更改self.Date(clickedDate)该值在运行时随着具有新数据的功能警报而变化,但是cluetip仍然与单击cal_box时所初始化的相同它重新初始化,或者您说再次在cal_box上滑动,但是我没有这样做。

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. 每次值更改时,更新功能都会触发。

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

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