get CustomButton Tag in js

4 posts, 1 answers
  1. Gusev
    Gusev avatar
    83 posts
    Member since:
    Dec 2012

    Posted 29 Apr 2013 Link to this post

    Hello!
    I use this
    command.Custom("edit").Click("editPlan");
    How I can in js method "editplan" get line  in which was clicked my custom button
    Because If I use:
    var grid = $("#Grid").data("kendoGrid");
     var Id= grid.dataItem(grid.select()).Id;
    I can select first element in grid and press button in other element(and I get Id from first element)
    I have attached a picture that shows it(error) :

    And please answer me, you don't forget to answer me?
    http://www.kendoui.com/forums/mvc/grid/clientdetailtemplateid-and-id-of-parent.aspx
    I wait 5 days :(

  2. Answer
    Dimo
    Admin
    Dimo avatar
    8446 posts

    Posted 30 Apr 2013 Link to this post

    Hello Grigoriy,

    You can use the event arguments to retrieve the table row:

    function editPlan(e) {
       var tableRow = $(e.target).closest("tr");
    }

    Once you have the row, you can retrieve its model using the Grid's dataItem() method, if needed.

    You will be contacted by a colleague of mine for further clarifications about the mentioned forum thread.

    Greetings,
    Dimo
    the Telerik team
    Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
  3. Gusev
    Gusev avatar
    83 posts
    Member since:
    Dec 2012

    Posted 06 May 2013 Link to this post

    Hello!
    This works good !
    But If I use not custom edit?(I use  .Editable(editable => editable.Mode(GridEditMode.PopUP))
    How I can get Parent?(or Id parent)
    This example of a bad:
    var parent = grid.dataItem(grid.select());
  4. Dimo
    Admin
    Dimo avatar
    8446 posts

    Posted 06 May 2013 Link to this post

    Hi Grigoriy,

    I suppose the Grid's documentation and the edit event will help you in this case.

    Regards,
    Dimo
    the Telerik team
    Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
Back to Top