如何检索 woodstock 表的选定行
我有一张带有复选框的 JSF woodstock 桌子。 当选择一行时,我想对这些项目进行一些处理。 我设法获取了 RowKey 对象的选择,但不知道如何获取我放入的原始对象。 该表由 ObjectListDataProvider 填充。
I have a JSF woodstock table with checkboxes. When a row is selected I want to do some processing with those items. I managed to get a selection of RowKey objects but can't find out how to get the original objects I put in back. The table is populated by an ObjectListDataProvider.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
所以我偶然发现了这个,并希望找到如何实际进行选择并获取行信息。 我最终弄清楚了,我认为其他人可能会从我的做法中受益。
我向 JSP 中的表列添加了一个 RadioButton,并添加了一个 valueChangeListener
在我的 Java 代码中,我创建了 valueChangeListener 函数并存储了当前行信息。
现在,如果您有任何按钮想要操作所选行中的数据,您可以执行此操作来获取对象数据。 贾斯珀在上面提到过这一点。
您也许可以将单选按钮的 selectedValue 属性与其他内容结合使用,而不是执行 valueChangeListener 并避免必须执行 valueChange 函数,但这有效,所以我不想找出另一种方法。
So I stumbled across this and was hoping to find how to actually do the selecting and get the row information. I eventually figured it out and I thought others might benefit from how I did it.
I added a RadioButton to a table column in the JSP and added a valueChangeListener
In my Java code I created the valueChangeListener function and stored the current row information.
Now if you have any buttons that want to manipulate the data in the selected row you can do this to get the object data. Jasper mentioned this above.
You might be able to use something like selectedValue attribute for radio button in conjunction with something else instead of doing valueChangeListener and avoid having to do a valueChange function but this worked so I didn't care to figure out another way.
能够回答自己的问题总是很高兴。
我设法通过将表的数据提供程序转换为 ObjectListDataProvider 并使用方法“getObject”来获取原始对象来解决这个问题。
Always nice to be able to answer you own questions.
I managed to solve it by casting the table's data provider to ObjectListDataProvider and use the method 'getObject' to get my original object back.