Kendo grid Add New Record start date giving throwing an error called"Uncaught ReferenceError: StartDate is not defined".

2 posts, 0 answers
  1. Nageswara
    Nageswara avatar
    3 posts
    Member since:
    Nov 2017

    Posted 13 Dec 2017 Link to this post

    Here i have grid with columns, when try to add a new record giving an error and following is the code.

    dataSource: response.DCMMappings,
    schema: {
    type: 'json',
    parse: function (data) {
    $.each(data.items, function (i, val) {
    val.StartDate = toDate(val.StartDate);
    val.EndDate = toDate(val.EndDate);

    pageable: false,
    height: 550,
    toolbar: ['create'],
    columns: [
    { field: 'DCMId', title: 'DCM Id', width: '120px', format: '{0: 0}' },
    { field: 'StartDate', title: 'Start Date', width: '120px', format: '{0: dd-MMM-yyyy}', template: '# if( false ) { #<span>#: kendo.toString(new Date(), "dd-MMM-yyyy")#<span># } else {#<span>#: kendo.toString(toDate(StartDate), "dd-MMM-yyyy")#<span>#} #', editor: startDateEditor },
    { field: 'EndDate', title: 'End Date', width: '120px', format: '{0: dd-MMM-yyyy}', template: '#= kendo.toString(toDate(EndDate), "dd-MMM-yyyy") #', editor: endDateEditor },
    { command: ['edit', 'destroy'], title: '&nbsp;', width: '250px' }],
    editable: 'inline',
    edit: function (e) {
    //if (!e.model.isNew()) {

    detailTemplate: kendo.template($('#template').html()),
    detailInit: detailInit

    Please help to fix this.

    advance thanks.





  2. Stefan
    Stefan avatar
    2956 posts

    Posted 14 Dec 2017 Link to this post

    Hello, Nageswara,

    Thank you for the provided code.

    After inspecting it, I can assume that the issue may occur because the values used in the column templates are null. In this scenario I can suggest setting default values inside the model as in our demo:

    schema: {
                              model: {
                                id: "ProductID",
                                fields: {
                                   ProductID: { editable: false, nullable: true },
                                   ProductName: { validation: { required: true } },
                                   Category: { defaultValue: { CategoryID: 1, CategoryName: "Beverages"} },

    If the issue still occurs, please share the error message with us and send a runnable example reproducing the issue, and I will gladly assist further.

    Progress Telerik
    Try our brand new, jQuery-free Angular 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