本文介绍了通过视图分页时如何保持选择?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个简单的视图(第一列显示复选框),顶部有一个寻呼机.我想选择一些文档,然后将这些文档导出到 Excel(使用 apache POI).

I have a simple view ( first column shows checkbox ) with a pager on top. I would like to make a selection of documents that then will be exported to Excel ( using apache POI ).

我可以在第 1 页上选择 2 个文档,但是当我切换到另一个页面选择更多文档时,我在第 1 页上的所有选择都消失了.

I can select 2 documents on page 1, but when I switch to another page to select more documents, all my selection on page 1 is gone.

如何在通过视图分页时保持选择?

How can I keep selection when paging thru the view??

推荐答案

可以使用

viewPanel.getSelectedIds()

但我假设,由于您的问题,这仅适用于当前页面.一个解决方案是添加一个带有服务器端 onclick 事件的自定义复选框列,它将添加当前选定的notedid 放入一个作用域变量(包含一个向量)中.在加载行时,您将检查是否找到了此变量,如果找到,请选中复选框.在页面之间切换时,您可以选择更多文档.

but I assume, because of your question, this is for the current page only. A solution would be to add a custom checkbox column with a serverside onclick event which will add the current selected notedid into a scoped var (containing a vector). On load of the row you will check if this var is found and if so check the checkbox. When you switch between pages you can select more documents.

选择完成后,可以使用生成的向量生成excel文档.生成完成后,再次清理范围变量,您就完成了.

When you are done selecting, you can use the generated vector to generate the excel document. After generation is done clean the scoped var again and you are done.

像馅饼一样简单;)

这篇关于通过视图分页时如何保持选择?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-28 01:00