Link button to Kendo Grid add item event

4 posts, 1 answers
  1. Austin
    Austin avatar
    24 posts
    Member since:
    Jun 2015

    Posted 01 Apr 2016 Link to this post

    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 instead 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!

  2. Answer
    Patrick
    Admin
    Patrick avatar
    230 posts

    Posted 01 Apr 2016 Link to this post

    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!
     
  3. Austin
    Austin avatar
    24 posts
    Member since:
    Jun 2015

    Posted 01 Apr 2016 in reply to Patrick Link to this post

    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!

  4. Patrick
    Admin
    Patrick avatar
    230 posts

    Posted 04 Apr 2016 Link to this post

    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!
     
Back to Top