Rich:Columns - FilterBy

会有一股神秘感。 提交于 2019-12-11 17:16:34

问题


Good morning!!

I have a dynamic datatable and I'm using Columns of Richfaces, but when I assign the value to FilterBy, it does not work. Can anyone help me? Woe is my code ..

<rich:dataTable id="dtAtendimento" value="#{CadastroAtendimentoTecnico.listaAtendimento}" var="atendimento">
    <rich:columns index="index" value="#{CadastroAtendimentoTecnico.listaCampos}" var="column" filterBy="#{column.nomeAtributo}" filterEvent="onKeyUp">
        <f:facet name="header">
            <h:outputText value="#{column.label}"/>
        </f:facet>
        <h:outputText value="#{atendimento[column.nomeAtributo]}"/>
    </rich:columns>
</rich:dataTable>

回答1:


Try adding sortBy="#{column.nomeAtributo}" and sortOrder to rich:columns it will work. I came to know that we have such problems on early version. Please try RF 3.2.1. I think it should solve the problem otherwise.




回答2:


From what I can see you are using the wrong attribute in filterBy. You want to use nesting to specify where to find the element to sort on. Something like #{atendimento(column.nomeAtributo)}, but I am not in a place I can test it. What this essentially does is evaluate the name of the column and then calls the getter with the same name off of your row object atendimento. Sorry if the nesting syntax doesn't work, but I think nesting is your answer.

If #{atendimento[column.nomeAtributo]} works to print the value then that is what you want, but I would only expect it to work if nomeAtributo is an integer for array referencing.




回答3:


I've come across another issue with filterBy which can cause problems. We had the filterBy working on entities in a certain business state (active, expired etc) but not in others. The state of the entity had nothing to do with the actual filter value.

When I used a filterMethod and did the filtering on the backing bean it worked fine. It turned out that filterBy submits the whole form while on my inputText for the filterMethod I used ajaxSingle. A validation failed when you submitted that form in total but the validation error was swallowed.



来源:https://stackoverflow.com/questions/1927743/richcolumns-filterby

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!