I want to copy data from flexgrid and I have a little problem. I am using filtering and I jus开发者_如何转开发t 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?
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:
foreach (C1.Win.C1FlexGrid.Row item in _c1FlexGrid.Rows.Selected)
{
if (!item.Visible)
item.Selected = false;
}
Clipboard.SetDataObject(_c1FlexGrid.Clip);
I hope that this help someone else too :)
精彩评论