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

Unable to Save from Kendo Grid pop up editor

1 Answer 118 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Dave
Top achievements
Rank 1
Dave asked on 22 May 2014, 04:33 PM
Hey everyone

I have a Kendo grid set up with ".Editable(editable => editable.Mode(GridEditMode.PopUp) ) "

When I click the edit button in the grid , the screen pops up as normal. Properties are set correctly, however when I alter a property and save, I get the error below.

0x800a138f - Microsoft JScript runtime error: Unable to get value of the property 'data': object is null or undefined

This error is happening in the "Kendo.all.js" file. Here is the relevent javascript:

setup: function(options, type) {
options = options || {};

var that = this,
parameters,
----------------------------------------------------------------------------------------------------------------------------------------------------------
operation = that.options[type], //**** the operation gets set to 'Undefined' by this line and fails on the line below. *****/
-----------------------------------------------------------------------------------------------------------------------------------------------------------
data = isFunction(operation.data) ? operation.data(options.data) : operation.data;

options = extend(true, {}, operation, options);
parameters = extend(true, {}, data, options.data);

options.data = that.parameterMap(parameters, type);

if (isFunction(options.url)) {
options.url = options.url(parameters);
}

return options;
}

What is happening to cause this and how do I resolve it?

Thanks,

Dave


1 Answer, 1 is accepted

Sort by
0
Dave
Top achievements
Rank 1
answered on 22 May 2014, 06:53 PM
Ok guys, nevermind. I've got this one figured out, but I figured I would share just in case someone else runs into this nightmare.

We were setting our grid up exactly the way it is done in the example given at:

http://demos.telerik.com/kendo-ui/web/grid/editing-popup.html

However, later on in the code we created a datasource and did this: 
 
var grid = $("#grid").data("kendoGrid");
grid.setDataSource(someNewDataSource);

Doing that effectively stomped the datasource that was put in place when the grid was initialized. Now when we got to the javascript above in the kendo.all.js, it was looking for one of the read/update/create/destroy that were part of the original datasource. Since someNewDataSource was created without the read/update/create/destroy functions, the operation cannot find them and is thus set to 'Undefined'. The the code blows up.

I am working now to make sure the read/update/create/destroy functions are set when someNewDataSource is created.  
Tags
Grid
Asked by
Dave
Top achievements
Rank 1
Answers by
Dave
Top achievements
Rank 1
Share this question
or