VirtualQueryableCollectionView and Export

7 posts, 1 answers
  1. Dario Concilio
    Dario Concilio avatar
    129 posts
    Member since:
    Apr 2016

    Posted 19 Apr Link to this post

    Hi,

    I would export by datagrid and I populated it by VirtualQueryableCollectionView collection.

    Example:

    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.

  2. Dilyan Traykov
    Admin
    Dilyan Traykov avatar
    371 posts

    Posted 21 Apr Link to this post

    Hello Potito,

    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:

    var viewModel = this.RadGridView.DataContext as ViewModel;
    viewModel.View.LoadSize = this.RadGridView.Items.TotalItemCount;

    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.

    Regards,
    Dilyan Traykov
    Telerik
    Do you need help with upgrading your AJAX, WPF or WinForms project? Check the Telerik API Analyzer and share your thoughts.
  3. UI for WPF is Visual Studio 2017 Ready
  4. Dario Concilio
    Dario Concilio avatar
    129 posts
    Member since:
    Apr 2016

    Posted 22 Apr in reply to Dilyan Traykov Link to this post

    It's clear, I try to explain the events in sequence:

    1. open my usercontrol that contains RadGridView, its itemsource is in binding with VirtualQueryableCollectionView (without filter it shows 1000 rows).
    2. 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)
    3. This approach allows to show quickly my data, when I scrolldown I see more rows, actually I see 20 rows (first 20 items loaded)
    4. 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.
    5. 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
  5. Answer
    Dilyan Traykov
    Admin
    Dilyan Traykov avatar
    371 posts

    Posted 26 Apr Link to this post

    Hello Potito,

    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.

    Regards,
    Dilyan Traykov
    Telerik
    Do you need help with upgrading your AJAX, WPF or WinForms project? Check the Telerik API Analyzer and share your thoughts.
  6. Dario Concilio
    Dario Concilio avatar
    129 posts
    Member since:
    Apr 2016

    Posted 27 Apr in reply to Dilyan Traykov Link to this post

    I'm sorry, I've mistake a property.

    This is my code

    var view = new VirtualQueryableCollectionView((List<Customer>) response.Info) { LoadSize = 10 };
    Customers = view;

  7. Dilyan Traykov
    Admin
    Dilyan Traykov avatar
    371 posts

    Posted 27 Apr Link to this post

    Hello Potito,

    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?

    Regards,
    Dilyan Traykov
    Telerik
    Do you need help with upgrading your AJAX, WPF or WinForms project? Check the Telerik API Analyzer and share your thoughts.
  8. Dario Concilio
    Dario Concilio avatar
    129 posts
    Member since:
    Apr 2016

    Posted 27 Apr in reply to Dilyan Traykov Link to this post

    Perfect!

    Thank you very much.

Back to Top
UI for WPF is Visual Studio 2017 Ready