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

Kendo grid with nested data causes error when filtering on null objects

2 Answers 460 Views
Grid
This is a migrated thread and some comments may be shown as answers.
wizmagister
Top achievements
Rank 2
wizmagister asked on 30 Apr 2014, 07:27 PM
Hi,

Our datasources data are generated with nested objects from the server and sometimes, some values can be null.

At first, I had to do custom template functions for every column to display them according to their values, so I created a function that either returns the value of the object, or an empty string if on any given level, it is null. However, if I try filtering that column, an exception is thrown.

I have created a sample code to show this error, just try adding a filter to the column to see the error : http://jsfiddle.net/UXBcW/1/

Thanks

2 Answers, 1 is accepted

Sort by
0
wizmagister
Top achievements
Rank 2
answered on 01 May 2014, 06:54 PM
I also wanted to add, the same issue happens when I set a datasource schema (which would be used to have the appropriate column filters)

Thanks
0
Petur Subev
Telerik team
answered on 02 May 2014, 11:59 AM
Hello Marc-Andre,

This is happening because you are binding the column to a field from a nested object which can sometimes be null. To avoid this you will need to either flatten your model or you will have to ensure that every nested object is not null. To achieve this you can use schema.parse 

Also you will have to specify the read operation as function and provide the data to it.

http://jsbin.com/jorap/3/edit

Kind Regards,
Petur Subev
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
wizmagister
Top achievements
Rank 2
Answers by
wizmagister
Top achievements
Rank 2
Petur Subev
Telerik team
Share this question
or