This is a migrated thread and some comments may be shown as answers.

Link button to Kendo Grid add item event

3 Answers 346 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Austin
Top achievements
Rank 1
Austin asked on 01 Apr 2016, 03:34 PM

Okay so what I'm trying to do is relatively simple but I can't figure out how to get it work properly.

I have a grid that is using inline editing. I don't really care for the Kendo Toolbar on top of the grid so I have an "Add New" button that is in a div outside of the grid. My question is, how do I call the Kendo Add New event when that button is clicked so that a new entry in the grid appears?

Thanks!

3 Answers, 1 is accepted

Sort by
0
Accepted
Patrick | Technical Support Engineer, Senior
Telerik team
answered on 01 Apr 2016, 06:13 PM
Hello Austin,

Please take a look at this Telerik Dojo illustrating how to add a row via an external button.

Here's the code I used for the Kendo button and my add function:
$("#btnCreate").kendoButton({
    click: add
 });
 
 
function add(){
    var grid = $("#grid").data("kendoGrid");
    grid.addRow();
}

addRow() adds an empty data item to the Kendo Grid. 
 

Hope this helps.

Regards,
Patrick
Telerik
 
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
 
0
Austin
Top achievements
Rank 1
answered on 01 Apr 2016, 06:16 PM

Wow, I didn't realize it was that simple! I guess I just didn't know what search terms to use to pull up what I was looking for.

Thanks for the quick help!

0
Patrick | Technical Support Engineer, Senior
Telerik team
answered on 04 Apr 2016, 03:23 PM
Hi Austin,

Glad to help and that everything is working!

Regards,
Patrick
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
Austin
Top achievements
Rank 1
Answers by
Patrick | Technical Support Engineer, Senior
Telerik team
Austin
Top achievements
Rank 1
Share this question
or