Code: Select all
<script type="text/javascript">
//<![CDATA[
/**
* PrimeFaces Ultima Layout
* @Override _bindEvents method
*/
PrimeFaces.widget.Ultima = PrimeFaces.widget.Ultima.extend({
_bindEvents: function() {
this._super();
var $this = this;
$(document.body).off('click').on('click', function(e) {
if(($this.isHorizontal() || $this.isSlim()) && !$this.menuClick && $this.isDesktop()) {
$this.menu.find('.active-menuitem').removeClass('active-menuitem');
$this.menu.find('ul:visible').hide();
$this.menuActive = false;
}
if(!$this.topbarMenuClick && !$this.topbarLinkClick) {
$this.topbarItems.find('.active-top-menu').removeClass('active-top-menu');
}
if(!$this.menuClick && $this.isSlim()) {
$this.deactivateItems($this.menu.children('.active-menuitem'), false);
}
debugger; /* Please add this line to test if check */
console.log($this.isOverlayInputPanelClicked(e));
if(!$this.rightPanelClick && !$this.rightPanelButtonClick && $this.rightPanel.hasClass('layout-rightpanel-active') && !$this.isDatePickerPanelClicked() && !$this.isOverlayInputPanelClicked(e)) {
$this.rightPanel.removeClass('layout-rightpanel-active');
$this.rightPanelButton.removeClass('rightpanel-btn-active');
}
if(!$this.topbarMenuClick && !$this.topbarLinkClick) {
$this.topbarItems.removeClass('topbar-items-visible');
}
$this.menuClick = false;
$this.menuButtonClick = false;
$this.topbarLinkClick = false;
$this.topbarMenuClick = false;
$this.rightPanelClick = false;
$this.rightPanelButtonClick = false;
});
},
isDatePickerPanelClicked: function() {
if($.datepicker) {
var input = $($.datepicker._lastInput);
if(input.closest('.layout-rightpanel').length && $('#ui-datepicker-div').is(':visible')) {
return true;
}
}
return false;
},
isOverlayInputPanelClicked: function(e) {
var el = $(e.target),
panel = el.closest('.ui-input-overlay');
if(panel.length) {
var inputId = panel.attr('id').replace(/_panel/g, '');
input = $(PrimeFaces.escapeClientId(inputId));
if(input.length && input.closest('.layout-rightpanel').length) {
return true;
}
}
return false;
}
});
//]]>
</script>