QueryableDomainServiceCollectionView, RadDataPager and Filtering

7 posts, 0 answers
  1. Rob Conley
    Rob Conley avatar
    47 posts
    Member since:
    Sep 2012

    Posted 16 Jan 2013 Link to this post

    I'm looking at this example http://demos.telerik.com/silverlight/#DomainDataSource/FirstLook. I'm actually implementing at TreeListview instead of a GridView, but I think it should be the same.

    Also, instead of using a RadDomainDataSource I'm implementing a QueryableDomainServiceCollectionView.

    Problem is, my filter query values are not being pushed back to the server. All the filtering is happening with the currently loaded data.

    I don't see any magic in the example that wires up the filter descriptors to get them to pass through. Before I post code, can anyone tell me what I am missing in getting the FilterDescriptors to pass through?

    -Rob
  2. Rob Conley
    Rob Conley avatar
    47 posts
    Member since:
    Sep 2012

    Posted 16 Jan 2013 Link to this post

    Looks like the GridView works in this manner, but the TreeListView does not.

    I was thinking that under the covers the TreeListView was a GridView.

    Is there any chance that this can be made to work?
  3. Vlad
    Admin
    Vlad avatar
    11100 posts

    Posted 17 Jan 2013 Link to this post

    Hello,

     Indeed this is customized version of the grid itself however the treelist cannot work on the server since the component will need to apply all operations like sorting, filtering, aggregates, etc. hierarchically.

    Greetings,
    Vlad
    the Telerik team

    Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

  4. Rob Conley
    Rob Conley avatar
    47 posts
    Member since:
    Sep 2012

    Posted 17 Jan 2013 Link to this post

    All I'm looking for is for the top level to be refreshed from the server. Since I was then going to load the nested levels on demand, it seems plausible that it could act the same way as the grid in that respect. Even if I had a defined hierarchy with EF entities or something it seems like reloading the data with filters applied would not be a show-stopper.

    I will take a quick look at applying the filters myself and switch back to the grid if that doesn't work.

    Thanks,
    Rob
  5. Rob Conley
    Rob Conley avatar
    47 posts
    Member since:
    Sep 2012

    Posted 17 Jan 2013 Link to this post

    I added a "where" FilterDescriptor to my QDSCV as documented at http://blog.falafel.com/blogs/11-03-18/RadDomainDataSource_and_being_MVVM_Friendly. Unfortunately, the RadTreeListView seems to want to hang on to the paged data it has a not "rebind" to my QDSCV. In other words, it simply filters the paged data it already has.

    I'll revert back to the Grid unless you have any other suggestions.

    -Rob
  6. Rob Conley
    Rob Conley avatar
    47 posts
    Member since:
    Sep 2012

    Posted 17 Jan 2013 Link to this post

    "Upon further review", this seams to work. Vm is the ViewModel. Level1 is the QueryableDomainServiceCollectionView. This code is in the view codebehind.

    I'm getting more than 1 hit on the database however. Perhaps the Rebind is unnecessary?

    Can you confirm that this in theory is a reasonable approach? That is, clearing the QDSCV filterdescriptors and adding the TreeListView descriptors to the QDSCV? Is there a better event to be applying this logic?
    private void MyTreeList_OnFiltered(object o, GridViewFilteredEventArgs e)
    {
      Vm.Level1.FilterDescriptors.Clear();
      MyTreeList.FilterDescriptors.ToList().ForEach(fd => Vm.Level1.FilterDescriptors.Add(fd));
      MyTreeList.Rebind();
  7. Vlad
    Admin
    Vlad avatar
    11100 posts

    Posted 22 Jan 2013 Link to this post

    Hello,

     Rebind() is not necessary since Add() will trigger automatic refresh of the source. 

    Kind regards,
    Vlad
    the Telerik team

    Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

Back to Top