[英]How to refresh jstree when value of knockout observable arrays has been updated?
[英]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.