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

toolbar buttons in nested kendo grid

1 Answer 72 Views
Grid
This is a migrated thread and some comments may be shown as answers.
JCSCo
Top achievements
Rank 1
JCSCo asked on 01 Jul 2015, 01:49 PM

Hi,

 

I have a kendo grid with a detail template for each row that holds another grid. On the nested grid I will have three custom toolbar buttons. I can access the click event of the custom button in general, but it does not seem to tie to a specific nested grid. Clicking on the button on one grid will give me access to the grid's contents, but when I click on the custom button from a different nested grid I get the data from the first one. Is there a way to add a unique id to the button so I can get the data for each specific grid on the click of the corresponding button? Here is the code I am using so far:

 

Grid:   toolbar: [  { name: "custom", text: "Custom" }
                    ],

 

Event Handler:   $(".k-grid-custom").click(function (e) {
            debugger
            var ledgerGrid = $(".ledger").data("kendoGrid");
            var selected = ledgerGrid._data[0].account_id;
        });

1 Answer, 1 is accepted

Sort by
0
Alexander Popov
Telerik team
answered on 03 Jul 2015, 08:01 AM
Hi,

You can try searching the DOM for the Grid closest to the toolbar button that was clicked. For example: 
$("#theParentGrid").on("click", ".k-grid-custom", function (e) {
  var grid = $(this).closest("[data-role='grid']").getKendoGrid();
  debugger
});


Regards,
Alexander Popov
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
JCSCo
Top achievements
Rank 1
Answers by
Alexander Popov
Telerik team
Share this question
or