我想禁用日历中的某些日期。我有代码来执行此操作,但在此代码中,日期是静态加载的。我需要从我的数据库中检索日期列表。
我知道如何从我的数据库中检索数据,但我不知道如何将它从商店传递到视图数组。有人可以帮我解决吗?
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."
});
答案 0 :(得分:0)
disabledDates
配置选项接受日期数组,所以如果你说你有便利的商店,你可以简单地做一些事情:
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."
});
答案 1 :(得分: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);