需要单击两次才能呈现数据

时间:2015-01-02 21:01:04

标签: jsf primefaces

我有一个数据表,必须在单击命令按钮后加载,但要渲染表我必须单击两次按钮。我怎么解决这个问题?

代码部分:

<h:body>
        <h:form>
            <h:inputText id="search" value="#{searchBean.user}" required="true"/>
            <p:commandButton id="searching" action="#{searchBean.search()}" value="search">
                <f:ajax execute="searching" render="datascroller" />
            </p:commandButton>
            <p:dataScroller  id="datascroller" value="#{searchBean.users}" var="user" chunkSize="10">
......

1 个答案:

答案 0 :(得分:0)

将您的代码更改为:

<h:body>
        <h:form>
            <h:inputText id="search" value="#{searchBean.user}" required="true"/>
            <p:commandButton id="searching" actionListener="#{searchBean.search}" value="search" process="searching" update="datascroller"/>
            <p:dataScroller  id="datascroller" value="#{searchBean.users}" var="user" chunkSize="10">