Skip to content

Commit

Permalink
#186: DatePicker's Show() function no longer fails if not mounted in DOM
Browse files Browse the repository at this point in the history
  • Loading branch information
FlowIT-JIT committed May 16, 2023
1 parent 96a27e5 commit ade73e7
Showing 1 changed file with 13 additions and 10 deletions.
23 changes: 13 additions & 10 deletions Controls/DatePicker/DatePicker.js
Original file line number Diff line number Diff line change
Expand Up @@ -919,20 +919,23 @@ Fit.Controls.DatePicker = function(ctlId)
{
initializeOnDemand(function()
{
var focused = Fit.Dom.GetFocused();
if (Fit.Dom.IsRooted(me.GetDomElement()) === true)
{
var focused = Fit.Dom.GetFocused();

datepicker.datepicker("show");
datepicker.datepicker("show"); // Fails if not rooted in DOM

// Allow light dismissable panels/callouts to prevent close/dismiss
// when interacting with calendar widget hosted outside of panels/callouts,
// by detecting the presence of a data-disable-light-dismiss="true" attribute.
var calendarWidget = document.getElementById("fitui-datepicker-div");
Fit.Dom.Data(calendarWidget, "disable-light-dismiss", "true");
// Allow light dismissable panels/callouts to prevent close/dismiss
// when interacting with calendar widget hosted outside of panels/callouts,
// by detecting the presence of a data-disable-light-dismiss="true" attribute.
var calendarWidget = document.getElementById("fitui-datepicker-div");
Fit.Dom.Data(calendarWidget, "disable-light-dismiss", "true");

moveCalenderWidgetLocally();
moveCalenderWidgetLocally();

if (focused === inputTime)
inputTime.focus();
if (focused === inputTime)
inputTime.focus();
}
});
}
else
Expand Down

0 comments on commit ade73e7

Please sign in to comment.