2015-06-15 87 views
1

我發現LF 6.2中的portlet中的日期字段存在一個問題。如何更改Liferay Portlet 6.2中aui-datepicker的zIndex屬性

問題是,單擊輸入字段後,日期選擇器正在顯示,但zIndex = 0,這意味着它位於portlet下。

如果我在firebug上將參數更改爲1,則一切正常。

我曾嘗試將zIndex添加到YUI代碼,但沒有成功。我如何更改DatePicker的zIndex?

我的代碼如下:

<i id="icon" class="icon-calendar icon-1x"></i> 
<input id="date" type="text" /> 

<aui:script> 

YUI().use('aui-datepicker', function (Y) { 

    var datePicker = new Y.DatePicker({ 
     trigger: '#date', 
     zIndex: 100 
    }); 

    Y.one('#icon').on('click', function(event) { 
     // Cannot do datePicker.show(); because of https://issues.liferay.com/browse/AUI-1795 
     var date = document.getElementById('date'); 
     date.focus(); 
     date.click(); 
    }); 
}); 


</aui:script> 

上面的代碼生成下面的HTML:

<div id="yui_patched_v3_11_0_2_1434399332971_43" class="datepicker-popover yui3-widget popover yui3-widget-positioned yui3-widget-modal yui3-widget-stacked bottom" style="left: 79px; top: 419px; display: block; z-index: 0;"> 

回答

3

您需要更改zIndexDatePicker的內部Popover

new Y.DatePicker({ 
    // ... 
    popover: { 
     zIndex: 1 
    } 
}); 

查看example pageAPI docs瞭解更多詳情。

+0

是的。感謝名單。這是正確的解決方案! –

相關問題