I need to set a value in inactive row.
However, If the active row is in edit mode, the value doesn't applies to the grid.
Please check following operation and code.
Case 1 (expected case):
・operation
①Click first record's "attribute" cell.(change to edit mode)
②In browser console, below command execute.
var item = $("#grid").data("kendoGrid").dataSource.at(0);
item.set("attribute", "123");
・result
first record's "attribute" value is changed from "foo" to "123".
Case 2 (unexpected case):
・operation
①Click second record's "attribute" cell.(change to edit mode)
②In browser console, below command execute.
var item = $("#grid").data("kendoGrid").dataSource.at(0);
item.set("attribute", "123");
・result
first record's "attribute" value isn't changed.
(The value of the model has been changed. But it does not apply to the grid.)
following is test code:
<!DOCTYPE html>
<
html
>
<
head
>
<
title
>KendoUI Test Page</
title
>
<
link
href
=
"http://cdn.kendostatic.com/2015.2.902/styles/kendo.common.min.css"
rel
=
"stylesheet"
/>
<
link
href
=
"http://cdn.kendostatic.com/2015.2.902/styles/kendo.default.min.css"
rel
=
"stylesheet"
/>
<
link
href
=
"http://cdn.kendostatic.com/2015.2.902/styles/kendo.dataviz.min.css"
rel
=
"stylesheet"
/>
<
link
href
=
"http://cdn.kendostatic.com/2015.2.902/styles/kendo.mobile.all.min.css"
rel
=
"stylesheet"
/>
<
script
src
=
"http://code.jquery.com/jquery-1.9.1.min.js"
></
script
>
<
script
src
=
"http://cdn.kendostatic.com/2015.2.902/js/kendo.all.min.js"
></
script
>
</
head
>
<
body
>
<
div
id
=
"grid"
></
div
>
<
script
>
function readonlyEditor(container, options) {
container.text(options.model[options.field]);
}
var dataSource = new kendo.data.DataSource({
data: [
{ id: 1, item: "Item1", attribute: "foo" },
{ id: 2, item: "Item2", attribute: "bar" }
],
schema: {
model: {
id: "id",
fields: {
id: { type: "number" },
item: { type: "string" },
attribute: { type: "string"}
}
}
}
});
$("#grid").kendoGrid({
dataSource: dataSource,
columns: [
{ field: "item"},
{ field: "attribute", editor:readonlyEditor }
],
editable: true,
});
</
script
>
</
body
>
</
html
>
what should I do? If I want to apply the value of the model to the grid in case 2.