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

Filtering entries within DropDownList with template and Angular filter

1 Answer 434 Views
DropDownList
This is a migrated thread and some comments may be shown as answers.
Nikola
Top achievements
Rank 1
Nikola asked on 08 Apr 2016, 06:48 AM

Hi guys,

 

I have a problem using the DropDownList with Angular and Angular Translate. Here is an example:

http://dojo.telerik.com/URUYO

 

Basically I use a simple template to appy an Angular filter to the value key. From my point of view this is a standard scenario, if I have a DropDownList expressing a foreign-key column from a database. The value is a key (such as a user status), but within the GUI I want a translated text to be displayed. Within the example everything works fine except the filter function of the DropDownList. The filter parses the key value, not the displayed text, as a user would expect. If you enter "KEY_2" a row will be found, entering the displayed text will result in no entries - irritating the user.

Is this a bug or am I doing something wrong?

 

Thanks & cheers,

Nikola

 

1 Answer, 1 is accepted

Sort by
0
Georgi Krustev
Telerik team
answered on 12 Apr 2016, 07:35 AM
Hello Nikola,

In general, the DropDownList widget is designed to filter the items based on the defined dataTextField option. In your configuration it is the "key" field, which means that the widget will search in the key fields.

Unfortunately, the widget is not aware what is happening in the defined templates, as they are out of its control. That being said, it would not be able to search in the output of the defined templates, as they are formatted text that the widget does not work with.

I am afraid that there is no workaround that I can suggest in this case. The only solution that I can think of is to actually bind the widget with the translated text, defined in the translation provider. Basically, you can construct JSON that contains "key" and "text" fields and the widget will search in "text" fields of the provided data.

Regards,
Georgi Krustev
Telerik
 
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
 
Tags
DropDownList
Asked by
Nikola
Top achievements
Rank 1
Answers by
Georgi Krustev
Telerik team
Share this question
or