开发者

Primefaces Dialog Focus

I开发者_运维百科s there a special way to include the p:focus on dialog window?


you can set focus to the dialog by calling the show() method for that dialog.

<p:dialog id="dialog" modal="true" widgetVar="ajaxDialog" width="0"
                  draggable="false" closable="false" resizable="false">
    <p:graphicImage value="./images/ajax-loader.gif" />
</p:dialog>

set the focus with

ajaxDialog.show();


You can set focus automatically when a dialog is shown, using the tag p:focus.

Example:

 <p:dialog id="myDialog">
    <h:form id="myForm">
        <p:focus context="myForm"/>
           <p:inputText id="username" value="#{userBean.username}/>
    </h:form>
 </p:dialog>

when you open the dialog, The first visible editable field will gain focus.

References:

  • PrimeFaces ShowCase - Focus
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜