RichFaces:当多列排序模式打开时释放 DataTable 的排序列

发布于 2024-11-09 18:04:05 字数 840 浏览 1 评论 0 原文

目前我正在开发一个项目(JSF 2.0,RichFaces 3.3.3),其中我必须获得一个启用多列排序的 2 列 DataTable(我已经通过 sortMode="Multi"sortMode="Multi" 属性),但是,与单列排序不同,在多列的情况下,我不可能释放正在执行排序的列(这是通过单击其他列标题在单列情况下完成的)。

排序顺序在会话期间被锁定:即使在选项卡之间切换时,我的 Web 应用程序也会维护当前的列排序设置。我需要在会话中恢复此配置以允许用户选择其他排序顺序,因为目前重置它的唯一方法是注销并重新输入。

例子: 当用户按 A 列排序,然后按 B 列排序(反之亦然)时,并且考虑到我正在使用 sortPriority属性也是如此(这是我无法更改的要求),当当前会话打开时,一对 AB 组合将被锁定。当用户只需要按一列对 DataTable 进行排序(按 AB 排序)时,在进行多列排序后不可能在同一会话中获得此结果。

有什么方法可以实现我需要的“组合列排序发布”吗?

提前致谢。

更新:

我发现数据表中只有两个数据列,唯一的方法是通过在 "Multi"" 之间切换 sortMode 属性单个” 值。这样我就可以保证在单列排序模式下会释放列的组合。

有没有人成功地处理过必须在运行时使用 javascript 为 rich:dataTable 组件属性赋值的情况?

Currently I'm developing a project (JSF 2.0, RichFaces 3.3.3) in which I have to get a 2-columns DataTable with multiple column sorting enabled (I've done this already via sortMode="Multi" property) but, unlike single column sorting, in the case of multiple columns is impossible for me to release the column or columns for which the sorting is being performed (this is done in single column case by clicking on other column header).

The sort order gets locked during the session: even when switching between tabs, my web application is maintaining the current columns sorting settings. I need to restore this configuration within the session to allow the user to select other sort order, because at present the only way to reset it is to log off and re-enter.

Example:
When the user makes a sorting by column A and then by column B (or vice-versa), and given that I'm using sortPriority property too (it's a requirement I can't change), the couple A-B combination gets locked while current session is open. When the user needs to sort the DataTable by only one column (sort by either A or B) it's impossible to get this in the same session after making a multi-column sorting.

Is there some way to achieve the "combined-column-sort release" I need?

Thanks in advance.

UPDATE:

I figured out that with only two data columns in my datatable the only way to do this is by toggling somehow the sortMode property between "Multi" and "Single" values. In such a way, I could guarantee that being in the single-column sorting mode it will release the combination of columns.

Has anyone worked successfully with the situation of having to ​​assign values to rich:dataTable component properties in runtime with javascript?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

零度℉ 2024-11-16 18:04:05

查看 sortBy 和 sortOrder 属性;cid=1272202" rel="nofollow">rich:dataTablerich:column。通过在 rich:column 上设置 sortOrder="UNSORTED",它应该清除该列的排序。您还可以在 rich:dataTable 本身上设置 sortOrder="UNSORTED" 和/或 sortBy="" 以获得更简单的解决方案(虽然我还没有尝试过)。您可以在 JavaScript onLoad 函数中或在将属性绑定到其属性的 bean 中执行此操作。

这应该比使用 sortMode 更优雅一点:)

Check out the sortBy and sortOrder attributes of rich:dataTable and rich:column. By setting sortOrder="UNSORTED" on the rich:column it should clear the sorting of that column. You may also be able to set sortOrder="UNSORTED" and/or sortBy="" on the rich:dataTable itself for a simpler solution (although I haven't tried it). You could do this in the JavaScript onLoad function or in a bean that has the attributes bound to its properties.

That should hopefully be a little more elegant than having to play with the sortMode :)

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文