0

我想禁用日历中的某些日期。我有代码可以做到这一点,但在这段代码中,日期是静态加载的。我需要从我的数据库中检索日期列表。

我知道如何从我的数据库中检索数据,但我不知道如何将它从存储传递到视图数组。谁能帮我解决它?

dateArray = ["06/17/2007","06/01/2007","05/17/2007","05/01/2007"];

dateField = new Ext.form.DateField({
            format:"m/d/Y",
            disabledDates:["^("+dateArray.join("|")+").*$"],
            disabledDatesText:"Date not available."
});
4

2 回答 2

0

disabledDatesconfig 选项接受日期数组,所以如果你说你有存储方便,你可以简单地执行以下操作:

var disabledDates = [];
store.each(function(record){
    disabledDates.push(record.get('putYourDateFieldNameHere'));
});
dateField = new Ext.form.DateField({
            format:"m/d/Y",
            disabledDates: disabledDates,
            disabledDatesText:"Date not available."
});
于 2013-06-11T10:30:32.477 回答
0

尝试...

var disabledDates = [];
store.each(function(record){
    disabledDates.push(record.get('putYourDateFieldNameHere'));
});
dateField = new Ext.form.DateField({
            format:"m/d/Y",
            disabledDatesText:"Date not available."
});
dateField.setDisabledDates(disabledDates);
于 2014-02-03T05:01:12.937 回答