This is a migrated thread and some comments may be shown as answers.
Continuously add new record after current new record saved?
4 Answers 73 Views
This is a migrated thread and some comments may be shown as answers.
Wicky
Top achievements
Rank 1
Wicky asked on 17 Feb 2013, 09:35 AM
Hello,

I would like to continuously add new record (popup edit) after current new record saved, is it possible?
Is there "saved" event could be used?

Thanks
Wicky

4 Answers, 1 is accepted

Sort by
0
Accepted
Alexander Valchev
Telerik team
answered on 19 Feb 2013, 09:44 AM
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:
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? 
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!
0
Alexander Valchev
Telerik team
answered on 06 Oct 2014, 09:17 AM
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:

$("#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!
 
Tags
Grid
Asked by
Wicky
Top achievements
Rank 1
Answers by
Alexander Valchev
Telerik team
Volker
Top achievements
Rank 1
Share this question
or