this is the strange behavior:
I have a RadGridView its ItemSource setted with a VirtualQueryableCollectionView.
User set a filter and then export, I use this method:
Sometimes it exports with first row of sheet dirty, because in first row there isn't columns header, but a row that does not belong to the collection (filtered by user).
PS: Normally, the first times export correctly header row (columns label), after several times appears that showed in SequenceExport.PNG
7 Answers, 1 is accepted
I tried to reproduce the behavior you've described but without any success.
Could you please have a look at the project I've attached to my reply and maybe modify it so that it demonstrates the undesired behavior?
Thank you in advance for your cooperation.
Thank you for support,
I think I found the problem, in first time I have not solved number of rows in excel exported yet, then I added a portion of code to keep the correct number of rows base user filter.
After that I saw that it counts total of rows (without filter applyed), this one generates a strange effect, it shows me the last rows of original collection instead of header rows.
I corrected code to have to obtain "the real rows count" (with filter applyed), then resolve my problem.
- Collection of 1000 rows used with VirtualQueryableCollectionView (loadsize = 10)
- user apply filters, result => grid shows 50 rows
- user export to excel (using view.LoadSize = p_GridView.Items.TotalItemCount;) => the first rows of excel show 1000th rows
- CORRECTION: use export to excel (using view.LoadSize = p_GridView.Items.Count;) => the first rows of excel show header row of grid
This is my code corrected.
I don't resolve.....
The first one and last one should not be there, they are more.
I don't understand where I wrong.
My method for retrive items for DataGridView
My method export:
Users can apply some filter by this method:
As I am unable to reproduce the behavior at my end I would like to ask you a couple of questions which might help in finding a solution to your issue:
1) What is the value of Items.Count right before the export? Is it different than the total amount of items exported?
2) If you handle the ItemsLoading event of the VCQV and place a breakpoint in it, does it get hit while exporting the GridView?
If the answer to any of these questions is yes, then probably this behavior is due to the fact that additional items are loaded while exporting the GridView. Using a Dispatcher might help in resolving this issue.
Ok, I reply to your request:
- CodeValues: values of VCQV
- Count Of gridView: values of RadGridView
- firstand last wrong: excel generated with first and last row wrong - they should not be there, instead of the first one should be columns header
- loadingdata: ItemsLoading event first one
- loading step 1: ItemsLoading event second one
Unfortunately, I am still unable to reproduce the issue you've described at my end. Could you please try to modify the project I attached in one of my previous replies in order to demonstrate the behavior you're observing and if you manage to achieve that, describe the steps needed to reproduce it?
If you are unable to reproduce the behavior using my sample project, may I kindly ask you to open a new support ticket and send over a project of your own, where the issue is observed?
Thank you in advance for your cooperation and understanding.