开发者

Primefaces DataTable - Filtering [column not filtering]

I am trying this example 'DataTable - Filtering'. Everything works except for the Search all fields: textbox that filters. when i enter 开发者_JAVA技巧characters to it it doesn't filter as in the example.

There is no errors or exceptions thrown. I don't undestand what onkeyup="carsTable.filter()" does in the code. can someone explain this ? and any idea why it fails to filter

<f:facet name="header">
    <p:outputPanel>
        <h:outputText value="Search all fields:" />
        <p:inputText id="globalFilter" onkeyup="carsTable.filter()" style="width:150px" />
    </p:outputPanel>
</f:facet>


carsTable is the name of the datatable. Somehow its missing from the example, but the p:dataTable should have an attribute widgetVar="carsTable". onkeyup is the event that is firedafter you released a key. It tells the carsTable to filter after you entered a new character.

So add the widgetVar="carsTable" attribute to p:dataTable and you are good to go.

If you have a look at the PrimeFaces userguide, you will find the correct example.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜