The datetimepicker filter is not properly persisted after saving and loading the state of the grid

3 posts, 1 answers
  1. El Mehdi
    El Mehdi avatar
    7 posts
    Member since:
    Jul 2017

    Posted 04 Sep 2020 Link to this post

    Hi,

    I am facing an odd behavior with the kendo grid menu datetimepicker filter.

    Replication (link https://dojo.telerik.com/aFOMARUq):
    1- Filter the grid using the "Start" column (select any date or time).
    2- Save grid state.
    3- Load the grid state.
    Check the "Start" column filter.

    Observed behavior: the time picker is no longer displayed.

    Is there something I am missing? any help or suggestions are much appreciated.

  2. Answer
    Georgi
    Admin
    Georgi avatar
    698 posts

    Posted 07 Sep 2020 Link to this post

    Hi Mehdi,

    The JSON.stringify is not capable of serializing function references, so before applying the options you have to manually restore the reference to the filterable.ui setting.

    e.g.

                  if (options) {
                    var parsedOptions = JSON.parse(options)
                    console.log(parsedOptions)
                    parsedOptions.columns[1].filterable.ui = dateTimePickerFilter;
                   ...

    Below you will find a modified version of the provided sample:

    Regards,
    Georgi
    Progress Telerik

    Virtual Classroom, the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products quickly just got a fresh new look + new and improved content including a brand new Blazor course! Check it out at https://learn.telerik.com/.

  3. El Mehdi
    El Mehdi avatar
    7 posts
    Member since:
    Jul 2017

    Posted 07 Sep 2020 in reply to Georgi Link to this post

    Hi Georgi,

    That's exactly what I was looking for.

    Much appreciated,
    Mehdi
Back to Top