简体   繁体   English

应用过滤器后,Primefaces数据表未正确呈现

[英]Primefaces Datatable not correctly rendered after filter applied

I have a Primefaces datatable that is inside an accordionPanel 我有一个在accordionPanel里面的Primefaces数据表
Now when I added a filter to one column, datatable is no more correctly displayed correclty when filter applied. 现在,当我向一个列添加过滤器时,在应用过滤器时,数据表不再正确显示。
When debugging, I can see that the org.primefaces.component.datatable.DataTableRenderer is called and it seems to work correctly (adding tr elements), but when I inspect the html in my browser, there are only inputs and plain text. 调试时,我可以看到org.primefaces.component.datatable.DataTableRenderer被调用,它似乎正常工作(添加tr元素),但是当我在浏览器中检查html时,只有输入和纯文本。
Here is the rendering of the datatable before filtering: 以下是过滤前数据表的呈现:

在点击过滤器之前的数据表

And here is the rendering of the datatable after selecting a filter value: 以下是选择过滤器值后数据表的呈现:

点击过滤器后渲染

And here is a little bit of code that can reproduce the issue: 这里有一些代码可以重现这个问题:

<p:accordionPanel multiple="true" id="someId" activeIndex="1">
   <p:tab title="title" id="tabId">
      <p:dataTable var="item" widgetVar="itemTbl" id="itemTbl" value="#{managedBean.items}" 
            filteredValue="#{managedBean.filtered}" style="margin-top:20px;">

          <p:column style="width: 129px !important">
                <f:facet name="header">
                    <h:outputLabel value="Column1"></h:outputLabel>
                </f:facet>
                <h:outputText value="#{item.id}"></h:outputText>
            </p:column>
          <p:column style="width: 101px !important" filterBy="name"
                filterOptions="#{managedBean.itemOptions}"
                        filterMatchMode="exact">
                <f:facet name="header">
                    <h:outputLabel value="Column2"></h:outputLabel>
                </f:facet>
                <h:outputText value="#{item.name}"></h:outputText>
            </p:column>
        </p:dataTable>
  </p:tab>
</p:accordionPanel>

I am using JSF 2.2 (Mojarra) and Primefaces 4. 我使用的是JSF 2.2(Mojarra)和Primefaces 4。

Any help would be more than appreciated 任何帮助都不仅仅是值得赞赏的

I finally found out the cause behind this weird behaviour: My datatable was placed inside a p:outputPanel with autoupdate set to true . 我终于找到了这种奇怪行为背后的原因:我的数据表放在一个p:outputPanel并将autoupdate设置为true I hope this will be of some help 我希望这会有所帮助

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM