How filter on multi values

7 posts, 0 answers
  1. Shaun
    Shaun avatar
    38 posts
    Member since:
    Sep 2012

    Posted 13 Mar 2014 Link to this post

    Hi,

    I'm trying to add a look up to a multi column combo, which has 2 columns, e.g. Name, Age.

    I added a filter descriptor as per you documentation, which works fine when the user types in a value "Bob" for example, drop down works fine.

    But what I'm trying to do programmatically is:

    MyString = "Bob , Fred, Sam";

    MyMultiColComboBox.Text = myString;

    I was hoping at this stage the drop down would open filters on the 3 names in my string, but I cannot get it to work.

    Is this possible or does the control only filter on a single value.

    Thanks for your help.

    Cheers

    Shaun








  2. Dimitar
    Admin
    Dimitar avatar
    2764 posts

    Posted 18 Mar 2014 Link to this post

    Hi Shaun,

    Thank you for writing.

    For this case you should use a CompositeFilterDescriptor which provides the desired functionality. For example you can create one like this: 
    CompositeFilterDescriptor compositeFilter = new CompositeFilterDescriptor();
    compositeFilter.FilterDescriptors.Add(new FilterDescriptor("Name", FilterOperator.IsEqualTo,"Bob"));
    compositeFilter.FilterDescriptors.Add(new FilterDescriptor("Name", FilterOperator.IsEqualTo, "Sam"));
    compositeFilter.FilterDescriptors.Add(new FilterDescriptor("Name", FilterOperator.IsEqualTo, "Janet"));
    compositeFilter.LogicalOperator = FilterLogicalOperator.Or;
     
    this.radMultiColumnComboBox1.MultiColumnComboBoxElement.EditorControl.FilterDescriptors.Add(compositeFilter);

    Let me know if you have additional questions.
     
    Regards,
    Dimitar
    Telerik
     

    DevCraft Q1'14 is here! Watch the online conference to see how this release solves your top-5 .NET challenges. Watch on demand now.

     
  3. Shaun
    Shaun avatar
    38 posts
    Member since:
    Sep 2012

    Posted 19 Mar 2014 in reply to Dimitar Link to this post

    Hi Dimitar,

    Thanks for getting back to me, I tried your solution but it does not seem to be working, when I enter a search string which triggers the below code nothing seems to happen. When I click on the multi col box drop down it crashed the application.

    Here's my code: Note I tried it with both
    this.ddVineyards1.MultiColumnComboBoxElement.EditorControl.FilterDescriptors
    and
    this.ddVineyards1.EditorControl.FilterDescriptors


    ​ private void radTextBox3_TextChanged_1(object sender, EventArgs e)
    {
    string Filter = GetVineyardByBlockName(tbNameSearch.Text);
    string[] words = Filter.Split(',');

    this.ddVineyards1.EditorControl.FilterDescriptors.Clear();

    CompositeFilterDescriptor compositeFilter = new CompositeFilterDescriptor();
    foreach (string word in words)
    {
    compositeFilter.FilterDescriptors.Add(new FilterDescriptor("Name", FilterOperator.IsEqualTo, word));
    }
    compositeFilter.LogicalOperator = FilterLogicalOperator.Or;
    this.ddVineyards1.EditorControl.FilterDescriptors.Add(compositeFilter);
    this.ddVineyards1.DropDownStyle = RadDropDownStyle.DropDown;
    }

    Any suggestions?

    Thanks

    Shaun.

  4. Shaun
    Shaun avatar
    38 posts
    Member since:
    Sep 2012

    Posted 19 Mar 2014 in reply to Dimitar Link to this post

    Note to self: coffee before coding......

    Ignore my last message, my column name was incorrect which produced the error.

    It's almost working, the drop down is not firing, but the filtering seems good..

    Cheers

    Shaun.
  5. Dimitar
    Admin
    Dimitar avatar
    2764 posts

    Posted 20 Mar 2014 Link to this post

    Hello Shaun,

    Thank you for writing back.

    I am glad that you have found a solution for your case. If you have any questions, please do not hesitate to contact us.

    Regards,
    Dimitar
    Telerik

    Build cross-platform mobile apps using Visual Studio and .NET. Register for the online webinar on 03/27/2014, 11:00AM US ET.. Seats are limited.

  6. Rashad
    Rashad avatar
    7 posts
    Member since:
    Oct 2013

    Posted 08 Aug 2018 Link to this post

    Hi Dimitar,

        I'm using the same concept to filter the combo-box instead of rebinding the data-source, because I have large number of data. Initially I'm loading all values in to the combo-box and based on some condition I'm filtering the combo-box. I have a list of filter names and I'm adding these names to the FilterDescriptors using  FilterOperator.IsEqualTo. When I click on the clear button it will clear the filter and show all values. The above code is working fine, but the problem is

    1. When I start typing a letter in the combo-box, then it is showing non filtered item(other items in the data-source which is starts with the typed letter) as suggestion in the editable area, also

    2. It is not showing the matched item in the combo-box even it is an exact match. but when I press backspace and remove the last letter and type again then it is showing the matched item.

    Any suggestion please.

     

    Thanks,

    Rashad

  7. Dimitar
    Admin
    Dimitar avatar
    2764 posts

    Posted 08 Aug 2018 Link to this post

    Hello Rashad,

    I am assuming that you are using RadMultiColumnCombobox. With this control, the grid filtering is used for the AutoComplete functionality. This is why you are seeing all the data, typing in the textbox would reset the filter values. The only solution I can think of is to prefilter your data source and assign the result data to the RadMultiColumnCombobox. This way you will be able to use the autocomplete as well. 

    As to the second question at hand, I was not able to reproduce this locally. I would suggest you open a new ticket for this case and attach your project or a sample project that reproduces the issue. This way we will be able to properly investigate it and provide a solution.

    I hope this will be useful. 

    Regards,
    Dimitar
    Progress Telerik
    Get quickly onboard and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
Back to Top