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

How to filter grid by cell content (dictionary text), not by model (dictionaty id)

3 Answers 79 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Vitaliy
Top achievements
Rank 1
Vitaliy asked on 13 Sep 2015, 09:05 AM

Hello,

 

I have a grid with a search box like the following:

Fiddle example

 

"Label" column contains a text so there are no any problem to filter grid with by this column. "statusId" column contains a dictionary element text, related to the identifier, kept in the statusId field of the model. So, when have "1" in the model, I see "Status1" in the grid cell

 

How could I filter grid by dictionary element text (so "2" in the filter box will show me rows, having "Status2" in the statusId column, and "Item2" in the label column?

3 Answers, 1 is accepted

Sort by
0
Boyan Dimitrov
Telerik team
answered on 15 Sep 2015, 02:33 PM

Hello Vitaliy,

The problem with the example that it expects an integer value for the statusId field. Please refer to the http://dojo.telerik.com/UWOYa example.

Regards,
Boyan Dimitrov
Telerik
 
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
 
0
Vitaliy
Top achievements
Rank 1
answered on 15 Sep 2015, 03:45 PM

Hello Boyan,

Thank you for the answer, but your sample covers only particular case. The ​real need is to make a search by the cell visible content (i.e. by text of foreign key values). So, when I type Status1 I get all rows having in the statusName column text containing "Status1" (Status1, Status11, Status10, etc)

0
Boyan Dimitrov
Telerik team
answered on 17 Sep 2015, 09:38 AM

Hello Vitaliy,

 

In general when ForeignKey column is used the value of the model field "statusId" in the DataSource is an integer. Operations such as sorting, filtering and etc are handled on DataSource level against the actual values ( the integer values for the "statusId" field). 

 

In order to implement filtering, sorting against the text value of the ForeignKey column custom code will be required. Please refer to the ForeignKey column sorting by text article that shows how to enable sorting by text in ForeignKey column using calculated field. Same pattern could be used for filtering as shown in http://dojo.telerik.com/AwINo example. 

 

 

 

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