Apache Wicket - 使用 FilterToolbar 进行数据表过滤与手动过滤
我正在使用 Wicket 1.4 DataTable 并手动过滤它,如 Apache Wicket Cookbook。它还可以在免费提供的示例章节中找到: https://www.packtpub.com/sites/default/files/1605OS-Chapter-5-Displaying-Data-Using-DataTable.pdf
但是我发现Wicket API 过滤器工具栏。现在在互联网上人们说 Wicketstuff 上的 Wicket Phonebook 就是一个例子,但是它不起作用。
与 Wicket Cookbook 中提供的手动过滤相比,使用带有 FilterToolbar 的 DataTable 有哪些优点? FilterToolbar 自动执行什么操作?我对 Wicket API 文档中关于 FilterToolbar 的这句话特别感兴趣:
表单组件由实现的列提供 IFilteredColumn。
代码示例或工作屏幕截图甚至页面都值得赞赏:)
i'm using a Wicket 1.4 DataTable and filter it manually like described in Apache Wicket Cookbook. It is also available in the freely available sample chapter: https://www.packtpub.com/sites/default/files/1605OS-Chapter-5-Displaying-Data-Using-DataTable.pdf
However i found in the Wicket API the FilterToolbar. Now on the internet people say that Wicket Phonebook on Wicketstuff is an example , but it's not working.
What are the advantages of using a DataTable with the FilterToolbar compared to this manual filtering presented in Wicket Cookbook? What is the FilterToolbar doing automatically? I'm especially intrigued by this sentence about the FilterToolbar in the Wicket API Docs:
Form components are provided by columns that implement
IFilteredColumn.
Code examples or working screenshots or even pages are appreciated :)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我可以毫无问题地在本地运行电话簿应用程序。从 https://github.com/wicketstuff/core/tree 下载/master/jdk-1.5-parent/phonebook 并使用
mvn jetty:run
运行。IFilteredColumn 的实现允许直接通过 DataTable 列创建过滤器组件。存在单选选项和文本框的实现。
就我个人而言,我远离 FilterToolbar,因为它会强制将整个表格包含在表单中。这张脸与“输入时”的ajax过滤相结合意味着浏览器不断地重新绘制过滤器表单组件以及表格,导致输入丢失,这非常烦人。
FilterToolbar 的一个有趣的方面是,它包含一些 javascript,用于在不使用 ajax 提交过滤器表单时将焦点恢复到正确的表单组件(不确定是否使用 ajax)。
I was able to run the phonebook app locally without problem. Download from https://github.com/wicketstuff/core/tree/master/jdk-1.5-parent/phonebook and run with
mvn jetty:run
.The implementations of IFilteredColumn allow the filter component to be created directly by the DataTable column. Implementations exist for radio choice and text box.
Personally, I stayed away from FilterToolbar because it forces your whole table to be included in a form. This face coupled with ajax filtering "as you type" means that the browser is constantly redrawing the filter form components along with the table, causing input to be lost which is quite annoying.
One interesting aspect of FilterToolbar is that it contains some javascript to restore focus to the correct form component when the filter form is submitted without ajax (not sure about with ajax).