2011-07-03 25 views
0

我正嘗試使用以下語法將我的對話框放在我的命令鏈接下方。但它不工作,而且,每當我向上或向下滾動頁面時,對話框的位置都在改變。任何幫助表示感謝。在命令鏈接下方定位Primefaces對話框

<p:dialog context="'mainForm:commandLinkA','tl','br'" widgetVar="TreeDlg" header="Select " draggable="false"> 

感謝和問候, 連珠

回答

1

我設法使用jQuery來解決問題。我點擊命令鏈接並傳遞要打開的對話ID和souce命令鏈接ID,調用以下jquery函數。

function adjustPositionandOpenDialog(currentDialog,commandSource) { 
    $(currentDialog).dialog('open');  
    var myDialogX = jQuery(commandSource).position().left+10; 
    var myDialogY = jQuery(commandSource).position().top - (jQuery(document).scrollTop() + jQuery('.ui-dialog').outerHeight())+142; 
    jQuery(currentDialog).dialog('option', 'position', [myDialogX, myDialogY]); 
} 

感謝,
連珠