How to set filter operator

5 posts, 0 answers
  1. Lilia
    Lilia avatar
    32 posts
    Member since:
    Mar 2011

    Posted 15 Aug 2011 Link to this post

    Can you tell me how can I set a default filter operator (for example "Is equal to") when I add a new filter criteria and I change the members drop down?
  2. Maya
    Admin
    Maya avatar
    4062 posts

    Posted 15 Aug 2011 Link to this post

    Hello Lilia,

    Please take a look at this forum thread. Does the solution suggested there corresponds to your requirements ?
     

    Best wishes,
    Maya
    the Telerik team

    Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get now >>

  3. DevCraft banner
  4. Lilia
    Lilia avatar
    32 posts
    Member since:
    Mar 2011

    Posted 15 Aug 2011 Link to this post

    Can you give me an example with RadDataFilter. I have this in xaml:

    <telerik:RadDataFilter x:Name="dataFilterSearchCriteria"
                            EditorTemplateSelector="{StaticResource EditorTemplateSelector}"
                            AutoGenerateItemPropertyDefinitions="False"                                      
                            CanUserCreateCompositeFilters="False"
                            Margin="0,0,0,0"
                            Canvas.ZIndex="1">
        <telerik:RadDataFilter.ItemPropertyDefinitions>
            <my:ItemPropertyDefinition DisplayName="Franchise name selector"
                                        PropertyName="Name"
                                        PropertyType="{Binding Source={StaticResource types}, Path=String}" />
            <my:ItemPropertyDefinition DisplayName="Date From"
                                        PropertyName="DateFrom"
                                        PropertyType="{Binding Source={StaticResource types}, Path=DateTime}" />
            <my:ItemPropertyDefinition DisplayName="Date To"
                                        PropertyName="DateTo"
                                        PropertyType="{Binding Source={StaticResource types}, Path=DateTime}" />
        </telerik:RadDataFilter.ItemPropertyDefinitions>
    </telerik:RadDataFilter>

    And I've tried to do this in "FilterOperatorsLoading" event, but it didn't do nothing:

    var comboBox = ((RadDataFilter)e.TriggerSource).ChildrenOfType<RadComboBox>()
                    .Where(b => b.Name == "PART_SimpleFilterOperatorComboBox")
                    .FirstOrDefault();
    if (comboBox != null)
    {
         comboBox.SelectedIndex = 0;
    }


  5. Lilia
    Lilia avatar
    32 posts
    Member since:
    Mar 2011

    Posted 16 Aug 2011 Link to this post

    I found my mistake. The problem was that I wasn't selecting the right ComboBox. Here is the right code:

    var comboBox = ((RadDataFilter)e.TriggerSource).ChildrenOfType<RadComboBox>()
                               .Where(b => b.Name == "PART_SimpleFilterOperatorComboBox")
                               .LastOrDefault();
    if (comboBox != null)
    {
       comboBox.SelectedIndex = 0;
    }

    I replaces FirstOrDefault with LastOrDefault to select the last added ComboBox.
  6. Rossen Hristov
    Admin
    Rossen Hristov avatar
    2478 posts

    Posted 31 Aug 2011 Link to this post

    Hi Lilia,

    Can you please answer the question that my colleague asked in your other thread first.

    Thank you.

    Kind regards,
    Ross
    the Telerik team

    Thank you for being the most amazing .NET community! Your unfailing support is what helps us charge forward! We'd appreciate your vote for Telerik in this year's DevProConnections Awards. We are competing in mind-blowing 20 categories and every vote counts! VOTE for Telerik NOW >>

Back to Top
DevCraft banner