or
| data: { | |
| name: function() { | |
| return "michael"; | |
| } | } |
$(this).kendoGrid(...)
I need to turn it off for a certain case. Is that possible?

var myDataSource = { schema: { model: { id: "RecordID", fields: { RecordID: { editable: false, nullable: true }, FirstName: { editable: true }, LastName: { editable: true } } } }, type: "odata", serverPaging: true, serverSorting: true, pageSize: 100, batch: false, transport: { read: "http://localhost:1625/Data/GetPatients", create: { url: "http://localhost:1625/Data/Create", contentType: "application/json; charset=utf-8", type: "POST" }, update: { url: "http://localhost:1625/Data/Update", contentType: "application/json; charset=utf-8", type: "POST" }, destroy: { url: "http://localhost:1625/Data/Destroy", contentType: "application/json; charset=utf-8", type: "POST", dataType: "json" }, parameterMap: function (data, operation) { if (operation !== "read") { return kendo.stringify(data); } else { return kendo.data.transports["odata"].parameterMap(data, operation); } } }};var myDataSource2 = new kendo.data.DataSource({ schema: { model: { id: "RecordID", fields: { RecordID: { editable: false, nullable: true }, FirstName: { editable: true }, LastName: { editable: true } } } }, type: "odata", serverPaging: true, serverSorting: true, pageSize: 100, batch: false, transport: { read: "http://localhost:1625/Data/GetPatients", create: { url: "http://localhost:1625/Data/Create", contentType: "application/json; charset=utf-8", type: "POST" }, update: { url: "http://localhost:1625/Data/Update", contentType: "application/json; charset=utf-8", type: "POST" }, destroy: { url: "http://localhost:1625/Data/Destroy", contentType: "application/json; charset=utf-8", type: "POST", dataType: "json" }, parameterMap: function (data, operation) { if (operation !== "read") { return kendo.stringify(data); } else { return kendo.data.transports["odata"].parameterMap(data, operation); } } }});$(document).ready(function () { $("#grid").kendoGrid({ dataSource: myDataSource, //This is working but if you change it to myDataSource2, then it doesn't work height: 500, scrollable: { virtual: true }, editable: true, sortable: true, toolbar: ["create", "save"], columns: ["RecordID", "FirstName", "LastName", { command: "destroy"}] });});$("#shortList").kendoGrid({
height: 400,
columns: [{
field: "name",
title: "Name"
}],
dataSource: {
data: [
{
name: "Test"
}]
}
});
then I get this exception when trying to add a row using API later:
TypeError: 'undefined' is not an object (evaluating 'this._set.indexOf')
$("#shortList").data("kendoGrid").addRow();
Using the latest commercial version of your software. How do I add a row using API?
function showSelectedImage() { var grid = $("#grid").data("kendoGrid"); //var data = grid.dataItem(grid.select()); grid.select().each(function () { var data = grid.dataItem($(this)); if (null != data) { $("#documentPreview").attr("src", data.ImageUrl); $("#documentPreview").attr("alt", data.DocumentId); $("#documentView").attr("src", data.ImageUrl); $("#documentView").attr("alt", data.DocumentId); $("#openImageHyperLink").attr("href", data.ImageUrl); if ($("#documentPreview").is(":hidden")) { $('#documentPreview').slideDown("slow", "easein", null); } if (null != data.ExtraPageUrls) { buildPager(data.ExtraPageUrls); } } }); }