This is a migrated thread and some comments may be shown as answers.

DropDown filter on DataValueField

2 Answers 703 Views
DropDownList
This is a migrated thread and some comments may be shown as answers.
Rui
Top achievements
Rank 1
Rui asked on 06 Nov 2017, 02:45 PM

Hi.
I have this dropdown

function SomeFilter(element) {

$(element).attr('id', "SOmething");

element.kendoDropDownList(
{
  dataSource: {
    transport: {
      read:
      {
        type: "POST",
        url: "@Url.Action("SomeAction", "SomeController")"
      }
    }
  },
  filter: "contains",
  highlightFirst: true,
  delay: 300,
  optionLabel: "Select Something",
  dataTextField: "dataTextField",
  dataValueField: " dataValueField ",
  select: onSelect,
  dataBound: onDataBound,
  open: onOpen
});
}

that is a filter in my grid

columns.Bound(e => e.SomeValue).Title("SomeTitle").Width(85).Filterable(x => x.UI("SomeFilter").Extra(false));

So far, so good. This all works fine. What I need to need is if there is a way to do the filtering on dataValueField instead of dataTextField.

2 Answers, 1 is accepted

Sort by
0
Ivan Danchev
Telerik team
answered on 08 Nov 2017, 10:58 AM
Hi Rui,

See this KB article, which shows how the DropDownList can be filtered by multiple fields. If in your scenario you need to filter only by the field set as dataValueField, you can set only that field (CustomerID in the linked example) in the dataSource's filters configuration:
this.dataSource.filter({
  logic: "or",
  filters: [
    {
      field: "CustomerID",
      operator: "contains",
      value: filterValue
    }
  ]
});


Regards,
Ivan Danchev
Progress Telerik
Try our brand new, jQuery-free Angular components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
0
Rui
Top achievements
Rank 1
answered on 08 Nov 2017, 11:04 AM

HI.
Yep, I did just that. On filtering event, I have

e.sender.dataSource.filter({

field: e.sender.options.dataValueField,

operator: e.filter.operator,

value: e.filter.value.toUpperCase()

});

 

This works for all my filters.
Tks.

Tags
DropDownList
Asked by
Rui
Top achievements
Rank 1
Answers by
Ivan Danchev
Telerik team
Rui
Top achievements
Rank 1
Share this question
or