Skip to content

Commit

Permalink
primefaces#11644 Disable DatePicker on Ajax
Browse files Browse the repository at this point in the history
  • Loading branch information
jepsar committed Mar 19, 2024
1 parent 558a8dc commit ed22339
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -383,6 +383,9 @@ PrimeFaces.widget.DatePicker = PrimeFaces.widget.BaseWidget.extend({
]
}
if (lazy) {
if (!this.panel.parent().is("div.ui-state-disabled")) {
this.panel.wrap("<div class='ui-state-disabled ui-datepicker-disabled'/>");
}
options.onsuccess = function(responseXML, status, xhr) {
PrimeFaces.ajax.Response.handle(responseXML, status, xhr, {
widget: $this,
Expand All @@ -407,6 +410,9 @@ PrimeFaces.widget.DatePicker = PrimeFaces.widget.BaseWidget.extend({
pdp.options.dateStyleClasses = dateStyleClasses;
$this.setDisabledDates(disabledDates);
$this.setEnabledDates(enabledDates);
if ($this.panel.parent().is("div.ui-state-disabled")) {
$this.panel.unwrap();
}
}
});
return true;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -126,4 +126,11 @@

.p-datepicker-panel .ui-datepicker-buttonbar .ui-g-6 {
text-align: center;
}
}

body .ui-state-disabled.ui-datepicker-disabled {
opacity: 1;
}
.ui-datepicker-disabled tbody a {
opacity: .4;
}

0 comments on commit ed22339

Please sign in to comment.