从 flexgrid 中过滤然后选择数据
我想从 Flexgrid 复制数据,但遇到了一些问题。我正在使用过滤,我只想复制选定的数据,但它复制“隐藏”的数据(不显示感谢过滤)。例如,我使用了过滤器,在 flexgrid 中只有几行,我想全部复制,因此单击左上单元格,它会选择所有显示的行,但是当我将其粘贴到某处时,它会粘贴到所有行(未显示的行)。使用 Shift 按钮选择行时相同。
我该如何“修复”它?我知道这是正常的,不是错误,但我需要更改它,我希望有简单的方法可以做到这一点。改变一些属性或类似的东西。
但如果没有的话,我实际上不知道如何做到这种“困难”的方式。我在想也许可以使用 _c1FlexGrid.Rows.Selected 并通过某种方式控制是否显示所选行。但我不知道怎么办。
感谢您的帮助
编辑
我发现,如果我将flexgrid的SelectionMode从Default更改为ListBox,那么我可以使用Rows.Selected并且它具有Visible属性,我可以检查行是否显示。所以我可以感谢这个只取显示的行。但现在我不知道如何将这些行添加到剪贴板。在我使用这个之前:
Clipboard.SetDataObject(_c1FlexGrid.Selection.Clip);
但现在我不知道哪个类用于保存显示的行然后保存到剪贴板。选择存在问题,因为我喜欢默认的 SelectionMode(CellRange)并且只选择所有行,这并不理想。有什么想法吗?
I want to copy data from flexgrid and I have a little problem. I am using filtering and I just want to copy selected data but It´s copy data which are “hide” (not show thx to filter). For example, I used filter and in flexgrid there are just few rows and I want to all copy so click to left upper cell and it select all shown rows but when I past it somewhere it past all rows (with that which arent shown). Same when select rows with Shift button.
How can I “fix” it? I know that´s normal and it´s not error but I need to change it and I hope that there is easy way to do that. Change some property or something like that.
But if there is not I actually dont have idea how to do that “hard” way. I was thinking that maybe use _c1FlexGrid.Rows.Selected and some way control if selected row is shown. But I dont know how.
Thanks for help
Edit
I figure out that if I change SelectionMode for flexgrid from Default to ListBox then I can use Rows.Selected and it has property Visible which I can check if row is shown or not. So I can thanks to this take just rows which are shown. But now I don´t know how can I add these rows to clipboard. Before I was using this:
Clipboard.SetDataObject(_c1FlexGrid.Selection.Clip);
but now I don´t now which class use to save shown rows and then at to clipboard. And there is problem with selecting because I like SelectionMode which was default (CellRange) and selecting just all rows it is not ideal. Any ideas?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
因为没有人能提供更好的解决方案,所以我将在这里写下我的解决方案。正如我在相关编辑中所写,SelectionMode 作为 CellRange 存在问题。我仍然不知道如何用这种模式“修复”它,但我知道如何用 ListBox 模式来做到这一点。
所以在flexgrid中将模式更改为ListBox。然后你可以在你的复制方法中使用它:
我希望这对其他人也有帮助:)
Because no one else get with better solution I´ll write here mine. As I wrote in Edit in question there were problem with SelectionMode as CellRange. I still don´t know how to "fix" it with this mode but I figure out how to do it with ListBox mode.
So in flexgrid change mode to ListBox. Then you can use this in your copy method:
I hope that this help someone else too :)