multiDatesPicker: how to disable clicking without changing date button color?

本秂侑毒 提交于 2020-01-07 03:20:22

问题


I downloaded multiDatesPicker here: http://multidatespickr.sourceforge.net

My Problem is..

I'm using multiDatesPicker only for represent added dates by codes.

And I don't want to receive any user interaction.

The only thing that how to disabling multiDatesPicker I know is "disabled: true" option. but this makes the calendar's added dates button color changed.

I already tried changing opacity using css(.ui-state-disabled) but it was just opacity.

Is there anyone who know how to just disabling calendar without changing anything that we can see ?


回答1:


self answer

this solution is work in both datepicker and multidatespicker. just follow 2 steps

First, change javascript

in your "jquery.ui.datepicker.js" source codes, find below

(unselectable ? '<span class="ui-state-default">' + printDate.getDate() + '</span>' : 
                         '<a class="ui-state-default' + ..

and change this to:

(/*(unselectable ? '<span class="ui-state-default">' + printDate.getDate() + '</span>' : 
                         */'<a class="ui-state-default' +

Second, add css style

#yourCal .ui-state-disabled {
    BACKGROUND-IMAGE: none; FILTER: none; opacity: .99;
}
.ui-datepicker .ui-datepicker-calendar .ui-state-highlight a {
    background: #743620 none;
    color: white;
}                       



回答2:


just add this one more option to your datepicker initialization code, it worked

 onSelect:function (dateText, inst) {
    var newDate = new Date();
    inst.drawMonth = newDate.getMonth();
    inst.drawYear = newDate.getFullYear();
    inst.currentMonth = newDate.getMonth();
    inst.currentYear = newDate.getFullYear();
}


来源:https://stackoverflow.com/questions/12318505/multidatespicker-how-to-disable-clicking-without-changing-date-button-color

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!