Q1 2010 Filtering problem

6 posts, 0 answers
  1. Ludovic Gerbault
    Ludovic Gerbault avatar
    226 posts
    Member since:
    Apr 2009

    Posted 15 Mar 2010 Link to this post

    Hi

    I've tried to combine the features of the radgrid grouping integration and the sorting and filtering mechanism.

    The sorting works fine (except for the fact that I haven't yet managed to perfom sorting when you sort a group header), but the filtering seems a bit more complicated.

    I subscribed to the filtered event of the grid, and in code behind, I use the to filteredevent to get the filterdescriptors that were both added and removed from the grid to add or remove them from the Chart

    Removing works fine, but if I try add more than one ChartFilterDescriptor, the data won't display anymore, until I reset the filter (ergo removing all the ChartFilterDescriptors)

    Is it a normal behaviour ?

    ie : The filtering code I'm using

     
            void DetailInfo_Filtered(object sender, GridViewFilteredEventArgs e) 
            { 
                Queue<ChartFilterDescriptor> filtersToRemove = new Queue<ChartFilterDescriptor>(); 
     
                foreach (ChartFilterDescriptor descriptor in RadChart1.FilterDescriptors) 
                { 
                    foreach (FilterDescriptor filter in e.Removed) 
                    { 
                        if (descriptor.Value.Equals(filter.Value)) 
                            filtersToRemove.Enqueue(descriptor); 
                    } 
                } 
     
                foreach (ChartFilterDescriptor descriptor in filtersToRemove) 
                    RadChart1.FilterDescriptors.Remove(descriptor); 
     
                foreach (FilterDescriptor filter in e.Added) 
                { 
                    RadChart1.FilterDescriptors.Add(new ChartFilterDescriptor(filter.Member, typeof(string), filter.Operator, filter.Value)); 
                } 
            } 
     
  2. Nikolay
    Admin
    Nikolay avatar
    385 posts

    Posted 17 Mar 2010 Link to this post

    Hi Subileau Pascal,

    I'm afraid we cannot reproduce the problem. Please, take a look at the sample project I've attached - using the filtered event of the grid, both adding and removing of filter descriptors work as expected and the chart is are displayed correctly.

    Should the sample code not help you, could you please isolate the issue in a project and send it to us, so we can inspect it further.

    Sincerely yours,
    Nikolay
    the Telerik team

    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
  3. DevCraft banner
  4. Ludovic Gerbault
    Ludovic Gerbault avatar
    226 posts
    Member since:
    Apr 2009

    Posted 20 Aug 2010 Link to this post

    Hi, I've just got back on this problem recently.

    It seems that if I have 2 ChartFilterDescriptors on the same Member with the operator IsEqualTo, they conflict each other.

    So I guess that the internal mechanism of the Chart is FilterDescriptor1 AND FilterDescriptor2 where I most certainly need FilterDescriptor1 OR FilterDescriptor2

    because for instance, in my collection, it is impossible to have Country = France AND country = GB at the same time, which is why each time I have 2 filterdescriptors, the chart is always empty.

    Am I correct, and if so, is there a way to change the interaction between 2 ChartFilterDescriptors ?
  5. Nikolay
    Admin
    Nikolay avatar
    385 posts

    Posted 25 Aug 2010 Link to this post

    Hello Subileau Pascal,

    Indeed, this is how the mechanism of filtering worked in your specific version ( 2010.1.309 ), i.e. FilterDescriptor1 AND FilterDescriptor2. Our developers have worked on extending the filtering capabilities and have introduced CompositeFilterDescriptor, which would allow for specific operators to be set, so that you could have FilterDescriptor1 OR FilterDescriptor2, etc. This has been introduced with our Latest Internal Build, version 2010_2_0821.

    Hope this helps.

    All the best,
    Nikolay
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  6. Ludovic Gerbault
    Ludovic Gerbault avatar
    226 posts
    Member since:
    Apr 2009

    Posted 25 Aug 2010 Link to this post

    Hello

    Thanks for the update

    I did the upgrade to the last internal build, would you happen to have a code sample on how to use the CompositeFilterDescriptior inside a RadChart ?
  7. Nikolay
    Admin
    Nikolay avatar
    385 posts

    Posted 27 Aug 2010 Link to this post

    Hi Subileau Pascal,

    Please, have a look at the code snippet below, which demonstrates how to use the CompositeFilterDescriptor :
    CompositeFilterDescriptor compositeDescriptor = new CompositeFilterDescriptor();
    compositeDescriptor.LogicalOperator = FilterCompositionLogicalOperator.Or;
    compositeDescriptor.FilterDescriptors.Add( new FilterDescriptor( "City", FilterOperator.IsEqualTo, "Berlin", false ) );
    compositeDescriptor.FilterDescriptors.Add( new FilterDescriptor( "City", FilterOperator.IsEqualTo, "Aachen", false ) );
    this.radChart.FilterDescriptors.Add( compositeDescriptor );

    Hope this helps.

    Best wishes,
    Nikolay
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
Back to Top
DevCraft banner