4 Answers, 1 is accepted
0
Accepted
Hello Wicky,
There is a save event, however it is not suitable for this task. I assume that you work with remote data and submit the changes to the server.
In such case, you should hook up to the requestEnd event of the dataSource which will fire after the dataSource request finishes successfully. If the operation type was create, you should hook up once to the dataBound event of the Grid and insert new row via addRow method. Basically the code is:
I hope this approach will fit in your scenario.
Kind regards,
Alexander Valchev
the Telerik team
There is a save event, however it is not suitable for this task. I assume that you work with remote data and submit the changes to the server.
In such case, you should hook up to the requestEnd event of the dataSource which will fire after the dataSource request finishes successfully. If the operation type was create, you should hook up once to the dataBound event of the Grid and insert new row via addRow method. Basically the code is:
requestEnd:
function
(e) {
var
type = e.type,
grid = $(
"#grid"
).data(
"kendoGrid"
);
if
(type ===
"create"
) {
grid.one(
"dataBound"
,
function
() {
this
.addRow(); });
}
}
I hope this approach will fit in your scenario.
Kind regards,
Alexander Valchev
the Telerik team
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
0
Volker
Top achievements
Rank 1
answered on 02 Oct 2014, 10:39 PM
What is descirbed by Alexander worked fine for us - until the last update.
Was there a change so that this no longer works?
Was there a change so that this no longer works?
0
Volker
Top achievements
Rank 1
answered on 02 Oct 2014, 10:43 PM
Sorry, I did a test now in your online-demo by adding the suggested code to the popup-edit-demo. As expected, the code no longer works..
We would really urgently need a working solution again!
We would really urgently need a working solution again!
0
Hi Volker,
The problem occurs because now the Window widget has a closing animation. I can suggest the following workarounds:
1. (Recommended one) Disable the window animation:
2. (Not recommended) Call the addRow method after a given timeout:
Regards,
Alexander Valchev
Telerik
The problem occurs because now the Window widget has a closing animation. I can suggest the following workarounds:
1. (Recommended one) Disable the window animation:
$(
"#grid"
).kendoGrid({
dataSource: dataSource,
pageable:
true
,
height: 550,
toolbar: [
"create"
],
columns: [
{ field:
"ProductName"
, title:
"Product Name"
},
{ field:
"UnitPrice"
, title:
"Unit Price"
, format:
"{0:c}"
, width:
"120px"
},
{ field:
"UnitsInStock"
, title:
"Units In Stock"
, width:
"120px"
},
{ field:
"Discontinued"
, width:
"120px"
},
{ command: [
"edit"
,
"destroy"
], title:
" "
, width:
"200px"
}],
editable: {
mode:
"popup"
,
window: {
animation:
false
}
}
});
2. (Not recommended) Call the addRow method after a given timeout:
requestEnd:
function
(e) {
var
type = e.type,
grid = $(
"#grid"
).data(
"kendoGrid"
);
if
(type ===
"create"
) {
grid.one(
"dataBound"
,
function
() {
var
that =
this
setTimeout(
function
() {
that.addRow();
}, 500);
});
}
}
Regards,
Alexander Valchev
Telerik
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!