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

MVC Grid - .addRow() causes Javascript Exception in kendo.all.js

5 Answers 323 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Chris T.
Top achievements
Rank 1
Chris T. asked on 29 Jun 2018, 04:01 PM

This problem is only happening since I update to the latest version (2018.2.620) of UI for ASP.NET MVC from 2016.3.1028.  Yeah, I know - I should keep up.  But the project is in maintenance mode now.

I know this isn't likely much to go on, but I can't imagine how I'd pack the entire project and databases (or fakes thereof) and send it in, so I'm hoping something jumps out and is quite obvious.  Any help appreciated!  Even just a better idea what to look at would be good!

I have a button outside my grid for adding rows.  It triggers .addRow() as follows:

$("#EntryGrid_New").click(function () {
  $("#EntryGrid").data('kendoGrid').addRow();
});

 

When I hit that code, I get the following error:

Unhandled exception at line 26, column 9426 in http://localhost:23159/Scripts/kendo/2018.2.620/kendo.all.min.js
0x800a138f - JavaScript runtime error: Unable to get property '_move' of undefined or null reference occurred

The line it stops on in kendo.all.js is:

    if (arguments.length === 1) {
        return on.call(that, arguments[0]);
    }
    var context = that, args = slice.call(arguments);
    if (typeof args[args.length - 1] === UNDEFINED) {
        args.pop();
    }
    var callback = args[args.length - 1], events = kendo.applyEventMap(args[0], ns);
    if (support.mouseAndTouchPresent && events.search(/mouse|click/) > -1 && this[0] !== document.documentElement) {
        MouseEventNormalizer.setupMouseMute();
        var selector = args.length === 2 ? null : args[1], bustClick = events.indexOf('click') > -1 && events.indexOf('touchend') > -1;
        on.call(this, {
            touchstart: MouseEventNormalizer.muteMouse,
            touchend: MouseEventNormalizer.unMuteMouse
        }, selector, { bustClick: bustClick });
    }
    if (typeof callback === STRING) {
        context = that.data('handler');
        callback = context[callback];
        args[args.length - 1] = function (e) {
            callback.call(context, e);
        };
    }
    args[0] = events;
    on.apply(that, args);
    return that;
},

 

For completeness, here's the definition of the grid:

@(Html.Kendo().Grid<TimePlus.Models.ScheduleExceptionViewModel>()
  .Name("EntryGrid")
  .NoRecords("No exceptions found")
 
  .Columns(columns => {
    columns.Bound(model => model.ExceptionDate);
    columns.Bound(model => model.ExpectedHours).EditorTemplateName("TwoDecimals");
    columns.Command(c => { c.Edit(); c.Destroy().Text("Remove"); }).Width(250);
  })
 
  .Editable(e => e.Mode(GridEditMode.InLine))
  .Events(e => e.Edit("EntryGrid_Edit"))
 
  .DataSource(dataSource => dataSource
    .Ajax()
    .Read(read => read.Action("Schedule_EntryGrid_Read", "Management").Data("GetSelectedDateAndUser"))
    .Destroy(destroy => destroy.Action("Schedule_EntryGrid_Destroy", "Management"))
    .Update(update => update.Action("Schedule_EntryGrid_Update", "Management"))
    .Create(create => create.Action("Schedule_EntryGrid_Create", "Management"))
    .Events(e => e.Error("EntryGrid_Error"))
    .Model(model => {
      model.Id(c => c.ID);
    })
  )
)

 

5 Answers, 1 is accepted

Sort by
0
Georgi
Telerik team
answered on 03 Jul 2018, 12:40 PM
Hello Chris,

Thanks for the provided code.

I have investigated the configuration of the grid and I did not notice anything that might cause the described behavior.

I have tested the addRow method using the Kendo 2018 R2 SP1 version (2018.2 620), but I was not able to reproduce the issue.

Attached you will find the sample I used for testing. Please examine it and let me know what I am missing. Have in mind that it will be necessary to restore all references to build the project

I look forward to your reply.


Regards,
Georgi
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.
0
Chris T.
Top achievements
Rank 1
answered on 06 Jul 2018, 05:32 PM
I managed to get the solution trimmed down to just the page in question - I'll submit a ticket and see if anyone there can take a look at it.
0
Georgi
Telerik team
answered on 09 Jul 2018, 12:50 PM
Hi Chris,

Take your time to assemble a sample where the issue occurs and send it back to us.

Once we are able to debug the issue locally we will provide you with more to the point solution.

Thanks in advance for your cooperation.


Regards,
Georgi
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.
0
Chris T.
Top achievements
Rank 1
answered on 09 Jul 2018, 03:57 PM

Ok...this just got weird.

In simplifying the app, I decided to get rid of the bundles and call the files directly.  Then, on a whim, I figured I try pointing to the cdn instead of my local files.  Now EVERYTHING WORKS.

I pulled down the cdn files in question and compared them to my local copies - IDENTICAL. The only differences are in the html headers - I used Fiddler to grab the TextView of each file and compared them.  Not a difference.  And yet, one works, one doesn't.

I guess I'll just have to hope Networking doesn't decide to block the CDN on me

This works:

This doesn't:

<script src="/Scripts/kendo/2018.2.620/angular.min.js"></script>
<script src="/Scripts/kendo/2018.2.620/jszip.min.js"></script>
<script src="/Scripts/kendo/2018.2.620/kendo.all.min.js"></script>
<script src="/Scripts/kendo/2018.2.620/kendo.aspnetmvc.min.js"></script>
0
Georgi
Telerik team
answered on 11 Jul 2018, 06:39 AM
Hi Chris,

Could you please assemble a small sample which uses the local scripts and send it back to us so we can investigate the cause locally?

Thanks in advance for your cooperation.


Regards,
Georgi
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.
Tags
Grid
Asked by
Chris T.
Top achievements
Rank 1
Answers by
Georgi
Telerik team
Chris T.
Top achievements
Rank 1
Share this question
or