버튼 패널 내에 체크 상자가있는 날짜 선택 도구가 두 개 있습니다. 이 확인란이 선택되어 있는지 여부에 따라 날짜 선택 도구를 변경하려고합니다. 날짜 선택 도구를 실제로 변경하는 경우를 제외하고는 모두 작동하는 것으로 보입니다. 내가 달성하려고하는 것은 : 체크 박스가 체크되어 있다면 날짜 선택 도구는 월요일에 주 번호와주의 첫날을 보여줍니다. 상자를 선택하지 않으면이 주 번호와 한 주를 시작하는 요일을 표시하지 않습니다 일요일체크 상자를 기준으로 날짜 선택기를 변경하십시오.
입니다스크립트 : 귀하의 주요 문제의 범위가
$(".datepicker").datepicker({
showOn: 'button',
buttonText: 'Date',
showButtonPanel: true,
showWeek: false,
firstDay: 0,
beforeShow: function (input, inst) {
setTimeout(function() {
var buttonPane = $(input)
.datepicker("widget")
.find(".ui-datepicker-buttonpane");
var html = "";
var html = '<div class="broadcastFilter"><input type="checkbox"><label> Use Broadcast calendar </label></div>';
buttonPane.append(html);
test.DateSelectionDateEventBind();
var optionChecked = $('.broadcastFilter input[type="checkbox"]').is(':checked');
//works fine up until here.
buttonPane.click(function() {
if(optionChecked)
{
$(".datepicker").datepicker('option', 'showWeek', true);
$(".datepicker").datepicker('option', 'firstDay', 1);
}
else
{
$(".datepicker").datepicker('option', 'showWeek', false);
$(".datepicker").datepicker('option', 'firstDay', 0);
}
});
}, 1);
},
onChangeMonthYear: function (input) {
setTimeout(function() {
var buttonPane = $(input)
.datepicker("widget")
.find(".ui-datepicker-buttonpane");
var html = '<div><input type="checkbox"><label> Use Broadcast calendar </label></div>';
buttonPane.append(html);
test.DateSelectionDateEventBind();
}, 1);
}
});
http://jsfiddle.net/dan_vitch/zEper/8/
우수 답변. 모든 도움에 감사드립니다. –