gpt4 book ai didi

javascript - datepicker onselect 未从 gridmvc.js 插件触发

转载 作者:行者123 更新时间:2023-11-28 08:46:34 25 4
gpt4 key购买 nike

dateContainer.datepicker({
defaultDate: this.filterValue,
changeMonth: true,
changeYear: true,
dateFormat: 'MM-dd-yyyy',
onSelect: function (dateText, t) {
var type = $context.container.find(".grid-filter-type").val();
$context.cb(type, dateText);
}
});

我正在使用 gridmvc.js 和 bootstrap-datepicker.js 插件。OnSelect 事件无论如何都不会触发。不知道是什么原因?

最佳答案

不知道什么原因,出现了这个问题。但我已经找到了临时解决方案。对于解决方案,您必须更改 bootstrap-datepicker.js 中的一行代码。 (在更改和使用插件之前检查许可证)

case 'span':
if (!target.is('.disabled')) {
this.viewDate.setUTCDate(1);
if (target.is('.month')) {
var day = 1;
var month = target.parent().find('span').index(target);
var year = this.viewDate.getUTCFullYear();
this.viewDate.setUTCMonth(month);
this._trigger('changeMonth', this.viewDate);
if (this.o.minViewMode === 1) {
this._setDate(UTCDate(year, month, day,0,0,0,0));
}
} else {
var year = parseInt(target.text(), 10)||0;
var day = 1;
var month = 0;
this.viewDate.setUTCFullYear(year);
this._trigger('changeYear', this.viewDate);
if (this.o.minViewMode === 2) {
this._setDate(UTCDate(year, month, day,0,0,0,0));
}
}
this.showMode(-1); this.fill();

这里出现问题是因为调用了 this.fill() 。

如果您在插件中评论此行,日期选择器不会以任何方式隐藏月份和年份的更改。或者您可以通过以下方式进行更改,

if (target.is('.month')) {
if (!this._o.changeMonth) {
this.fill();
}
}
else {
if (!this._o.changeYear) {
this.fill();
}
}

然后,根据您在创建日期选择器时给出的参数,这将起作用。

关于javascript - datepicker onselect 未从 gridmvc.js 插件触发,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19704098/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com