I would export by datagrid and I populated it by VirtualQueryableCollectionView collection.
I have a lot of row (ex. 1000)
I used a pagesize 10
I try to export and I see the lines already loaded only.
How can I load (in this case) all rows?
Note: User can filter any columns.
6 Answers, 1 is accepted
If you want to be able to export all items you must ensure that they are loaded.
For example, if you ViewModel has a VirtualQueryableCollectionView called View, you can do this in the following way:
Bear in mind that this will lead to poor performance when dealing with large amounts of data.
What I can suggest is to use a QueryableCollectionView or other collection that has all the items available.
I hope you find this information helpful.
It's clear, I try to explain the events in sequence:
- open my usercontrol that contains RadGridView, its itemsource is in binding with VirtualQueryableCollectionView (without filter it shows 1000 rows).
- Apply some filter, result it shows me a subset of 100 rows. But with pagesize = 10, it shows me a little subset of data (this only rows is loaded)
- This approach allows to show quickly my data, when I scrolldown I see more rows, actually I see 20 rows (first 20 items loaded)
- At a certain point, I would like to export my data based on filter that I set, but I have seen 20 rows of 100 total and 100 rows are the result of the filters set.
- OK! Now I press button to export......and now? I should be able to load all 100 rows before exporting, but only the 100 because I have to take account of the filters
Could you please confirm that you meant PageSize and not LoadSize in step 2 of your last reply as this statement contradicts to the 3rd step you've described as you will not be able to scroll to the next 10 items if there was a RadDataPager involved?
If that is not the case, and you did mean LoadSize, the method, provided in my last reply should work correctly. To better demonstrate this, I'm attaching a sample project for you to have a look at. I've tested it with the steps you've described in your last reply and it seems to behave as expected. Please correct me if I'm wrong.
If you are, however, using a RadDataPager, I recommend having a look at the "Export Paged Data Excel" example from our SDK Samples Browser.
I hope you find this helpful.
I'm sorry, I've mistake a property.
This is my code
Did you have a chance to take a look at the sample project I've provided in my last reply? If so, could you let me know if the demonstrated approach is applicable to your scenario?
Thank you very much.