Primefaces DataTable - 过滤[未过滤的列]
我正在尝试这个示例“DataTable - Filtering”。除了过滤的搜索所有字段:
文本框之外,一切正常。当我向其中输入字符时,它不会像示例中那样进行过滤。
没有错误或异常抛出。我不明白 onkeyup="carsTable.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>
I am trying this example 'DataTable - Filtering'. Everything works except for the Search all fields:
textbox that filters. when i enter 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>
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
carsTable
是数据表的名称。不知何故,示例中缺少它,但p:dataTable
应该有一个属性widgetVar="carsTable"
。onkeyup
是释放按键后触发的事件。它告诉carsTable
在您输入新字符后进行过滤。因此,将
widgetVar="carsTable"
属性添加到p:dataTable
即可。如果您查看 PrimeFaces 用户指南,您会找到正确的示例。
carsTable
is the name of the datatable. Somehow its missing from the example, but thep:dataTable
should have an attributewidgetVar="carsTable"
.onkeyup
is the event that is firedafter you released a key. It tells thecarsTable
to filter after you entered a new character.So add the
widgetVar="carsTable"
attribute top:dataTable
and you are good to go.If you have a look at the PrimeFaces userguide, you will find the correct example.