Hello all,
I have a problem with save one row. Here is my code:
DataSource:
var
localDataSource =
new
kendo.data.DataSource({
batch:
true
,
transport: {
read:
function
(options) {
$.ajax({
url:
"Content/JSON/GridData.json"
,
success:
function
(result) {
options.success(result);
},
error:
function
(result) {
options.error(result);
}
});
},
update:
function
(options) {
console.log(
"update call"
);
options.success();
}
},
schema: {
model: {
id:
"Id"
,
fields: {
Name:
"Name"
,
Position:
"Position"
}
}
}
});
Kendo grid:
var
grid = $(
"#grid"
).kendoGrid({
dataSource: localDataSource,
editable:
true
,
toolbar: [
"save"
,
"cancel"
],
columns: [
{
command: {
name:
"saveOneRow"
, text:
"save"
, click:
function
(e) {
var
row = $(
this
).closest(
'tr'
);
grid.editRow(row);
grid.saveChanges();
// save all
}
}, title:
" "
, width:
"180px"
},
{ field:
"Name"
, width:
"100px"
, title:
"Name"
},
{ field:
"Position"
, width:
"100px"
, title:
"Position"
},
],
}).data(
'kendoGrid'
);
Save all and cancel all works fine.
But how can I save one row?
(because localDataSource.sync() (save all) and localDataSource .read() (cancel all).)
p.s. I tried command {name: "save"}, but he didn`t fire any event
Thanks