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

Grouping on nested null values

5 Answers 544 Views
Grid
This is a migrated thread and some comments may be shown as answers.
wizmagister
Top achievements
Rank 2
wizmagister asked on 18 Nov 2014, 03:50 PM
Hello,

I've been using grids with my server data for a while now and I've encountered a few issues that I could resolve myself (For example, I had to create a template function for every columns since sometime my data may contain null values and the grid crashes otherwise).

In the same direction of my example, if I have a grouped column on one of those null values, the grid crashes and I can't find a way to inject my function that converts the null object to a empty string.

I isolated the issue down to this : http://dojo.telerik.com/aZIla
If you try to group by the Employee column, the errors occurs.

Thanks for any help!

5 Answers, 1 is accepted

Sort by
0
Nikolay Rusev
Telerik team
answered on 20 Nov 2014, 04:00 PM
Hello Marc-Andre,

In this case you can normalize your data by using schema.parse or parse function for the Employee field.

http://dojo.telerik.com/@rusev/iVuB

Regards,
Nikolay Rusev
Telerik
 
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
 
0
wizmagister
Top achievements
Rank 2
answered on 20 Nov 2014, 05:21 PM
Thanks for the reply, although your answer is not an acceptable solution.

The grid can receive a huge different type of data and recreating every single one of them on the client side would be a huge overhead and an unacceptable solution.

It receive from the server side a list of columns and the data. The only way I could do the parse function like you showed in your demo, is by trying to go though every columns defined and looking at the field name, trying to figure out the deepest level of each objects and recreating a default one. But creating an empty object is not the desired value since the value is actually null/non existant. And that would be done every time I generate a new grid... This would become a big overhead in my opinion.

I had the same issue when I initially created the grids but I countered this issue with my getValue function used for each column as a template, which takes for argument, the row and the field name requested.

The issue is actually occuring in a virtual function created, when it is comparing the values, it does something like this :

(function(d
/**/) {
return d.Employee.EmployeeName
})

If it could just be wrapped in the same way I did in my example for displaying columns.

Would this be a possible solutions and have this implemented in Kendo directly, or at least a custom handler where I could reference my function ?

Thanks!
0
Nikolay Rusev
Telerik team
answered on 24 Nov 2014, 11:28 AM
Hello Marc-Andre,

The Grid widget operates with homogeneous data and for all data transformations, such as sorting/filtering/grouping etc., and column field is used for building the descriptors. That said the field `Employee.EmployeeName` must be accessible for all items in the data source.

Here is what other options you have:
 - enable server operations, such as serverGrouping. Thus group descriptors will be send to server and you will be able to plug your own logic for grouping. 
 - enable serverGrouping and apply your custom grouping logic on client. Here is an example for this: http://dojo.telerik.com/@rusev/AXeke.

Regards,
Nikolay Rusev
Telerik
 
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
 
0
wizmagister
Top achievements
Rank 2
answered on 24 Nov 2014, 08:35 PM
Hello, I think your missing the big picture. We have 50 reports with 50 columns. You're suggesting that we add 2500 columns customizations. This is a very bad situation.

Why not check for NULL directly in the Kendo grid, while grouping. If it's null, you add an empty Group. (That's what DevExpress does)

Please let me know what the DEV thinks about this.

Thanks !
0
Nikolay Rusev
Telerik team
answered on 26 Nov 2014, 01:23 PM
Hello Marc-Andre,

I've already forwarded your feedback to our development team.

Currently the Grid and DataSource are not using "safe" getters, getters which null-check every field, as this comes with performance penalties. 

In such scenarios our suggestions are as follows: 
 - normalize the data by using parse function - suggested in the first post
 - enable server operation - suggested in the last post

 If you find this behavior as incorrect you can open new thread in our UserVoice portal.

Regards,
Nikolay Rusev
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
Nikolay Rusev
Telerik team
wizmagister
Top achievements
Rank 2
Share this question
or