UI的自举日期选择器:强制日期选择器的重新渲染? [英] ui-bootstrap datepicker: Force a re-render of a datepicker?

查看:136
本文介绍了UI的自举日期选择器:强制日期选择器的重新渲染?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

具体使用的UI引导的日期选择器和NO的jQuery ...

Specifically using ui-bootstrap's datepicker and NO jQuery...

所以,我想从两个datepickers缝在一起了各种各样的日期范围选择器,它是pretty接近。我想基于上月底日历,反之亦然选定日期的日历开始日期禁用。问题是,一开始只有日历或刷新时,选择该日历上做出重新呈现。所以,如果我选择结束日历日期,开始日历不会重新运行禁用的最新功能,并重新渲染,直到我再挑上开始日历的日期。

So, I'm trying to sew together a date range picker of sorts from two datepickers and it's pretty close. I'm trying to disable dates on the start calendar based on the date selected on the end calendar and vice versa. The problem is that the start calendar only refreshes or re-renders when a selection is made on that calendar. So if I select a date on the end calendar, the start calendar will not re-run the disable-date function and re-render until I pick a date on the start calendar again.

有谁知道一种方法来强制日历的重新渲染,或对所提供的禁用过期或定制类函数直接调用?

Does anyone know a way to force a re-render of a calendar or make a direct call to the supplied disable-date or custom-class functions?

推荐答案

如果我理解正确,你也有类似的问题,我有什么。我的getDayClass方法是依赖于从服务器加载的信息。所以,当小部件使得它无法使用,因此要求重新呈现,当我从服务器接收查找数据。

If I understand you correctly you have a similar problem to what I have. My getDayClass method is dependent on information loaded from the server. So when the widget renders it is not available, thus requiring a rerender when I receive the lookup data from the server.

<datepicker ng-model="selectedDate" 
            min-date="minDate" 
            show-weeks="false" 
            custom-class="getDayClass(date, mode)">
</datepicker>

我的小部件渲染,然后从服务器的响应后,我触发一个重新呈现更新styles.To触发我发现我可以只更新将selectedDate对象重新呈现组件:

My widget renders and then after the response from the server I trigger a rerender the component to update the styles.To trigger the rerender I have found I can just update the selectedDate object:

$scope.selectedDate = new Date($scope.selectedDate.getTime() + 1);

诚然,这是一个黑客位,但似乎现在的工作。

Admittedly this is a bit of a hack, but seems to work for now.

这篇关于UI的自举日期选择器:强制日期选择器的重新渲染?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆