Searching by multiple DataTextField variables

4 posts, 0 answers
  1. Richard
    Richard avatar
    1 posts
    Member since:
    Nov 2012

    Posted 04 Mar 2013 Link to this post

    When using .DataTextField() you are only able to search by one variable. Is there a way to search by multiple?

    For instance, using .DataTextField("CorpName") returns a list of items that start with the Corp name and .DataTextField("AccountNumber") returns a list of items that start with Account Number... I would like to return the search by both CorpName and AccountNumber.

    I am able to achieve this with autoComplete because each time it does a search, it is querying the database through a webservice and is therefore searching by both fields... but since this is a combobox, it only queries the database once and therefore I need to use .DataTextField() to search the returned list.
  2. Georgi Krustev
    Georgi Krustev avatar
    3724 posts

    Posted 05 Mar 2013 Link to this post

    Hello Richard,

    The ComboBox does not support filtering by multiple fields. Nevertheless, you can enable filtering and use your "autocomplete" approach.

    Georgi Krustev
    the Telerik team
    Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
  3. Ben
    Ben avatar
    2 posts
    Member since:
    Aug 2014

    Posted 23 Sep in reply to Georgi Krustev Link to this post

    I understand that you can't filter by multiple fields, but is there a way to specify a different field to filter on than the one used in the DataTextField?  I have a combobox that uses templates to display a "dropdown table" so the user can see both the ID and the Description, but when they select and item it needs to display just the ID in the combo box's display.  When they type the letters "AJ" they will find my sample data item below, but if they type "American" it won't find the item because it does not match the ID specified in the DataTextField.  Is there a way to keep "ID" as the DataTextField but have the filter use the field called "Combined"?

    @(Html.Kendo().ComboBoxFor(m => m.PublicationId)

    and my Data "Model.Publications" looks like this:  

    [{ ID: "AJ", Description: "American Journal", Combined: "AJ American Journal" }, etc...]



  4. Neli
    Neli avatar
    28 posts

    Posted 25 Sep Link to this post

    Hello Ben,

    If custom filtering different than the DataTextField is needed than the filtering event of the widget should be handled and its default behavior should be canceled. After that, the the DataSource filter method is used for implementing the filters according to the requirements. 

    Similar issue is discussed in the following Forum thread.

    I hope that the attached Dojo example will be helpful.

    Progress Telerik
    Try our brand new, jQuery-free Angular 2 components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
Back to Top