column not defined during schema parsing

1 Answer 28 Views
Data Source Grid
Benjamin
Top achievements
Rank 2
Iron
Veteran
Benjamin asked on 23 Jun 2022, 02:39 AM

Hi,

 

I have a date column where I need to parse to date format. when initialising the kendo grid, my console received an error about Uncaught ReferenceError: updatedDate is not defined

I have made a dojo to replicate this error

1 Answer, 1 is accepted

Sort by
0
Accepted
Patrick | Technical Support Engineer, Senior
Telerik team
answered on 23 Jun 2022, 12:42 PM

Hello Benjamin,

The error is due to the updatedDated object not being defined in the schema.  That being said, here is a way you can get the string date, parse it, and optionally format it:

JavaScript

  $("#kendo-table").kendoGrid({
    dataSource: {
      schema: {
        parse: function(data) {
          data.forEach((item) => {

            //trimmed string
            var strDate = item.updatedDate.trim();

            //parsed Date from updated Date
            var parsedUpdatedDate = kendo.parseDate(strDate, "d MMM yyyy");

            //Optional: set format of updated column
            item.updatedDate = kendo.toString(parsedUpdatedDate, "d MMM yyyy");
          });
          return data;
        }
      }
    },
    //...
  });

Please take a look at this updated Progress Kendo UI Dojo which demonstrates the above, and hope this helps!

Regards,
Patrick | Technical Support Engineer, Senior
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/.

Tags
Data Source Grid
Asked by
Benjamin
Top achievements
Rank 2
Iron
Veteran
Answers by
Patrick | Technical Support Engineer, Senior
Telerik team
Share this question
or