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

Kendo Grid Hierarchy - Print parent rows

2 Answers 400 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Håkan
Top achievements
Rank 1
Håkan asked on 03 Oct 2013, 06:15 AM
Hi,
I am using Kendo Grid Hierarchy in my ASP.Net Web application.
 For each row in my parent table, i have an option to print that row details.
My parent table is associated with a model. Each row in this parent table has several columns:
- ID
- Product Name
- External Number
- Print button
Here is my problem,
I need to print parent row before I explore the child table. That means before I use detailInit(e) function I need to get selected row ID to print that row.
My print function is,

 $("#GridName").on("click", ".k-grid-print", function (e) {
            e.preventDefault();
            var dataItem = $(e.target).closest('td').siblings(':first-child').text();     
            alert( dataItem );  
});
But in here "dataItem" is always empty. If I remove child table from the grid. Its worked. So How I can solve this problem ??

Regards,
Rukz

2 Answers, 1 is accepted

Sort by
0
Dimiter Madjarov
Telerik team
answered on 03 Oct 2013, 08:54 AM
Hello Hakan,


You could use the dataItem method in order to retrieve the model data for the current row. Here is a sample implementation.
E.g.
$("#Grid").on("click", ".print", function () {
    var grid = $("#Grid").data("kendoGrid");
    var dataItem = grid.dataItem($(this).closest("tr"));
    console.log(dataItem);
});

Please let me know if this was the information that you were looking for.

 

Regards,
Dimiter Madjarov
Telerik
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
0
Håkan
Top achievements
Rank 1
answered on 03 Oct 2013, 09:08 AM
Hi  Dimiter,
Yes Of course.. This is the way to solve my problem..Thank you very much for your help..
Tags
Grid
Asked by
Håkan
Top achievements
Rank 1
Answers by
Dimiter Madjarov
Telerik team
Håkan
Top achievements
Rank 1
Share this question
or