【问题标题】:How update/refresh options dynamicaly datetimepicker如何动态更新/刷新选项 datetimepicker
【发布时间】:2016-04-12 10:27:48
【问题描述】:

有没有办法动态更新 datetimepicker 的选项?

就我而言,在开始时,我在插件的选项 **disabledTimeIntervals ** 中设置我的“忙碌日期”数组。它工作正常,但是当我更改我的不同日期时,我会更新“忙碌日期”数组,并尝试通过在每次更改日期时传递更新的数组来设置新选项 disabledTimeIntervals:

$scope.options = {
                    locale: 'fr',
                    sideBySide: true,
                    format: 'DD/MM/YYYY à HH:mm',
                    useCurrent: false,
                    daysOfWeekDisabled: [0, 6],
                    stepping: 15,
                    disabledTimeIntervals: $scope.getBusyDates(),
                    ignoreReadonly: true
                };

element.datetimepicker(eval($scope.options)); 

不幸的是,这不起作用,并且 datetimepicker 忽略了我的新闻设置...如何强制 datetimepicker 在需要时查看选项?谢谢

【问题讨论】:

    标签: angularjs twitter-bootstrap datepicker datetimepicker


    【解决方案1】:

    响应:要设置这个新选项,我必须使用 Option 函数:(http://eonasdan.github.io/bootstrap-datetimepicker/Functions/#options)

    所以,正确的语法响应是:

    element.data('DateTimePicker').options(eval(scope.options));
    

    【讨论】:

      猜你喜欢
      • 2016-11-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2017-09-12
      • 1970-01-01
      • 2012-05-08
      • 1970-01-01
      相关资源
      最近更新 更多