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

Sorting/Filtering complex objects

4 Answers 817 Views
Grid
This is a migrated thread and some comments may be shown as answers.
George
Top achievements
Rank 1
George asked on 19 Aug 2015, 04:08 PM
Is it possible to apply sorting and filtering on complex objects or dynamic columns? My grid has many dynamic columns, and grid does not allow me to sort or filter by their type (datetime, or number). It considers them "string" values.

4 Answers, 1 is accepted

Sort by
0
George
Top achievements
Rank 1
answered on 20 Aug 2015, 03:43 PM
Any idea guys?
0
Alexander Valchev
Telerik team
answered on 21 Aug 2015, 10:54 AM
Hi George,

In order to sort or filter by the type, the type should be defined in the dataSource's schema. If it omitted the Grid will threat values as strings.

Filtering or sorting on complex objects is not supported at present. It is possible to set the column field configuration option to property of the complex object which will allow the user to sort or filter on that particular field. For example:

columns: [{ field: "complexObject.fieldName", title: "fieldName" /* etc... */ }]


I hope this information will help.

Regards,
Alexander Valchev
Telerik
 
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
 
0
Andre
Top achievements
Rank 1
answered on 20 Dec 2016, 04:25 AM
Hi Alexander Valchev your solution breaks the kendo grid functionality when we use dropwdown or combobox in an editor and template is bound to complexObject.fieldName. Have a look at this broken demo which I managed to break http://dojo.telerik.com/iLenu
0
Alexander Valchev
Telerik team
answered on 22 Dec 2016, 08:35 AM
Hello Andre,

Please check the updated example: http://dojo.telerik.com/iLenu/5

The issue occurs because of the way custom editor is bound to the dataSource field. In this case you should not bind the editor to `options.field` as it points to `user.userName`. The custom editor should be bound to the `user` field (the whole object).

$('<input required data-bind="value:' + options.field + '"/>') //old
$('<input required data-bind="value: user"/>') //changed to

In this way, when the editor value changes, the MVVM will update the `user` object, not just the `user.userName` field of the `user` object.

I hope this will help.

Regards,
Alexander Valchev
Telerik by Progress
Try our brand new, jQuery-free Angular 2 components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
Tags
Grid
Asked by
George
Top achievements
Rank 1
Answers by
George
Top achievements
Rank 1
Alexander Valchev
Telerik team
Andre
Top achievements
Rank 1
Share this question
or