Primefaces Datagrid在切换页面时没有更新数据

时间:2016-09-21 08:42:45

标签: jsf primefaces datagrid

当我切换页面数据不进行更新时,每次更改行数时,它不会发生变化。一切都是静态的,dataGrid没有变化。 带有dataGrid的xhtml页面:

<p:dataGrid rowIndexVar="rowIndex" columns="2" lazy="true" var="b" value="${libraryFacade.goods}"  id="booksList" styleClass="books_list"  paginator="true" rows="4" paginatorPosition="bottom"
                        rowsPerPageTemplate="2,4,6" paginatorTemplate="{RowsPerPageDropdown} {PageLinks}"  paginatorAlwaysVisible="true" emptyMessage="">
                <div class="item">
                    <div class="image-info">
                        <h:outputLink styleClass="content_link" value="#{request.contextPath}/PdfContent" target="_blank">
                            <p:graphicImage value="/ShowImage?index=#{rowIndex}" width="110" height="150"/>
                            <f:param name="id" value="#{b.id}"/>
                            <f:param name="save" value="false"/>
                        </h:outputLink>
                    </div>
                    <div class="info">
                        <div class="book_name">
                            <h:outputLink id="bookName" styleClass="title" value="#{request.contextPath}/PdfContent" target="_blank">
                                #{b.name}
                                <f:param name="id" value="#{b.id}"/>
                                <f:param name="save" value="false"/>
                            </h:outputLink>
                        </div>
                    </div>
                    <h:outputLink styleClass="mr" value="#{request.contextPath}/PdfContent" target="_blank">
                        <p class="read">Read</p>
                        <f:param name="id" value="#{b.id}"/>
                        <f:param name="save" value="false"/>
                    </h:outputLink>
                    <h:outputLink styleClass="mr" value="#{request.contextPath}/PdfContent" target="_blank">
                        <p class="download">download</p>
                        <f:param name="id" value="#{b.id}"/>
                        <f:param name="filename" value="#{b.name}"/>
                        <f:param name="save" value="true"/>
                    </h:outputLink>
                    <p:commandLink styleClass="mr" title="download" rendered="#{sec:areAllGranted('ROLE_ADMIN')}">
                        <p class="edit">download</p>
                    </p:commandLink>
                    <h:outputLink styleClass="delete-button" value="#{request.contextPath}/DeleteBook" title="delete" type="button" rendered="#{sec:areAllGranted('ROLE_ADMIN')}">
                        <p class="delete">delete</p>
                        <f:param name="selectedBook" value="#{b.id}"/>
                    </h:outputLink>
                </div>
            </p:dataGrid>

libraryFacade代码:

 @ManagedBean
    @Component
    public class LibraryFacade {
        private GoodsDAO goodsDAO = new GoodsDaoImpl();
        private List<Goods> goods = goodsDAO.getGoods();
        public List<Goods> getGoods() {
            return goods;
        }
    }

0 个答案:

没有答案