Filters added to QDSCV are not displayed in RadDataFilter

4 posts, 1 answers
  1. Teddy
    Teddy avatar
    3 posts
    Member since:
    Nov 2012

    Posted 06 Nov 2012 Link to this post

    I have a QueryableDomainServiceCollectionView bound to a RadDataFilter, RadGridView, and RadDataPager.  As I add filters programatically to the QDSCV's FilterDescriptors collection after the controls have already been loaded, the RadDataGrid and RadDataPager are updated as expected, but the RadDataFilter just keeps displaying the filters that were defined before the control was loaded.

    So, for example, I define a QDSCV and immediately add a FilterDescriptor on PropertyA, before the RadDataFilter is loaded.  When the RadDataFilter comes up, it correctly displays the filter on PropertyA.  However, if I then add another FilterDescriptor on PropertyB, and call Load on the QDSCV, the RadDataFilter does not display the new filter item (same thing happens if I remove a filter... no update on the UI).  The RadGridView and RadDataPager, however, will be displaying the newly filtered items.

    This is very confusing to the user as it creates a disconnect of the filter we're displaying, and the actual filter applied to the grid.

    I usually add a sample project that demonstrates the issue, but I'm not exactly sure how to provide a sample project with a working QDSCV.  Hopefully I've explained the issue well enough for you to reproduce on your end.

    I am currently running 2012.2.912.1040.
  2. Yordanka
    Admin
    Yordanka avatar
    634 posts

    Posted 09 Nov 2012 Link to this post

    Hello Teddy,

    Actually, this is not an issue but expected behavior because FilterDescriptors of the controls and FilterDescriptors of the QDSCV do not syncronize each other. When you add or remove FilterDescriptors of the QDSCV the data are filtered in the collection itself. And RadGridView displays the result not because it knows for these added or removed FilterDescriptors but because it receives data from the collection (which has been already filtered). RadDataFilter on other hand do not display data and those it will not be affected.
    I would recommend you to follow our online demos and documentation which completely cover how the QDSCV and RadDomainDataSource work.
     
    All the best,
    Yordanka
    the Telerik team

    Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

  3. DevCraft banner
  4. Teddy
    Teddy avatar
    3 posts
    Member since:
    Nov 2012

    Posted 09 Nov 2012 Link to this post

    Why is this the expected behavior?  What you're telling me is that changes to the RadDataFilter done by the user can affect the QDSCV's FilterDescriptors, but changes to the QDSCV's FilterDescriptors done programatically do not affect the RadDataFilter's UI... So you've set up a one-way only binding to the QDSCV and say it's the expected behavior???

    If that's the case, then is there any other way of changing the filters displayed in the RadDataFilter from the view model?  I've already tried subclassing the RadDataFilter, listening to changes on the bound QDSCV's FilterDescriptors, and making the same changes to the RadDataFilter's FilterDescriptors, but all that breaks when someone assigns a new QDSCV, since there's no DataContextChanged event in SL4 (I can't upgrade to SL5 yet).

    Please let me know if there's any way of achieving my desired functionality with the RadDataFilter... otherwise I'll have to find some other control to achieve the functionality I need.
  5. Answer
    Rossen Hristov
    Admin
    Rossen Hristov avatar
    2478 posts

    Posted 09 Nov 2012 Link to this post

    Hi,

    You are correct. This behavior is by design for many different reasons which I will not go into here.

    The only way of achieving your desired functionality would be to bind RadDataFilter to RadDomainDataSource.DataView as shown in the online examples. Then, if you add a FilterDescriptor to RadDomainDataSource.FIlterDescriptors, RadDataFilter should pick it up automatically. That is because RadDomainDataSource.DataVIew is a DataItemCollection instead of a QueryableCollcetionView and they behave differently.

    Currently, this is what our controls offer. It is up to you to decide whether they suit your concrete scenario or there is a better third-party tool for the purpose.

    Thank you for your understanding.

    Greetings,
    Rossen Hristov
    the Telerik team

    Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

Back to Top