Sorting/Filtering complex objects

5 posts, 0 answers
  1. George
    George avatar
    16 posts
    Member since:
    Mar 2012

    Posted 19 Aug 2015 Link to this post

    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.
  2. George
    George avatar
    16 posts
    Member since:
    Mar 2012

    Posted 20 Aug 2015 Link to this post

    Any idea guys?
  3. Alexander Valchev
    Admin
    Alexander Valchev avatar
    2886 posts

    Posted 21 Aug 2015 Link to this post

    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!
     
  4. Andre
    Andre avatar
    3 posts
    Member since:
    Nov 2016

    Posted 19 Dec 2016 in reply to Alexander Valchev Link to this post

    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
  5. Alexander Valchev
    Admin
    Alexander Valchev avatar
    2886 posts

    Posted 22 Dec 2016 Link to this post

    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.
Back to Top