Renju
Renju

Reputation: 51

Positioning Primefaces Dialog just below a Command Link

I am trying to use the below syntax to position my dialog just below my command link. But its not working and moreover, the dialog position is changing whenever I am scrolling the page up or down.Any help is appreciated.

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

Thanks and Regards, Renju

Upvotes: 0

Views: 2471

Answers (1)

Renju
Renju

Reputation: 51

I managed to solve the problem using jquery. I am calling the following jquery function on clicking the command link and passing it the dialog id to be opened and the souce command link id.

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] );
}

Thanks,
Renju

Upvotes: 1

Related Questions