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

[Solved] Filter does not work on 2 or more elements in one cell

5 Answers 119 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Markus
Top achievements
Rank 1
Markus asked on 26 Jan 2015, 03:21 PM
Hi

I have two elements in one cell using the return function for this particular field:

function(dataItem) {
       return kendo.htmlEncode(dataItem.Title) + "<br>" + kendo.htmlEncode(dataItem.City);
}

The filter does not work anymore, for example searching for "lon" (as in London) does not return any results.

http://dojo.telerik.com/ukOja/9

Mant thanks

5 Answers, 1 is accepted

Sort by
0
Rosen
Telerik team
answered on 28 Jan 2015, 09:12 AM
Hello Markus,

As you may know the filtering is done over the DataSource data (not over the UI) using the field to which the column is bound. Therefore, in the provided sample, searching for London in the Title column will not work as there is no such title value. If you want to filter on the combined values of title and city fields then you will need to create a field in the data which to hold their combined value and bind the column to this field.

Regards,
Rosen
Telerik
 
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
 
0
Markus
Top achievements
Rank 1
answered on 28 Jan 2015, 04:30 PM
Thank you for your reply.

Just to confirm: So what I want is to have value1<br>value2 in my cell and still being able to filter (search) for whatever string is in that column. -> That cannot be done, is that right?

Thanks
0
Rosen
Telerik team
answered on 29 Jan 2015, 10:02 AM
Hello Markus,

Yes, it it not supported. As I have stated in my previous reply you should have a field in the data which to have the value equal to the join value of both fields and then filter on this field.

Regards,
Rosen
Telerik
 
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
 
0
Markus
Top achievements
Rank 1
answered on 04 Feb 2015, 08:07 AM
Hi

Ok I have now created a field which has both the values. I can also easily send this in my "life" environment where my DB sends JSON data.

How can I send the "string" so that the second value is on a new line? The "<br>" tag does not seem to work, please see my example:

http://dojo.telerik.com/ukOja/11

Thanks
0
Rosen
Telerik team
answered on 04 Feb 2015, 01:59 PM
Hello Markus,

The <br/> does not work as the column value is encoded by default. You can disabled this by setting the encoded option of the column to false.

{
    field: "TitlenCity",
    width: 200,
    encoded: false
}


Regards,
Rosen
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
Markus
Top achievements
Rank 1
Answers by
Rosen
Telerik team
Markus
Top achievements
Rank 1
Share this question
or