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

get whole object on click grid row

1 Answer 989 Views
Grid
This is a migrated thread and some comments may be shown as answers.
MV
Top achievements
Rank 1
MV asked on 10 Jun 2016, 05:38 AM

I am using kendo Grid of kendo of ASP.NET MVC 2016.1.412.

My code where I want to get selected is:

 

column.Bound(e => e.Username).Title("Username").Groupable(true).ClientTemplate("<a style='cursor:pointer' onclick=EditProductDataObject(Username)>#=Username#</a>");

 

Here instead of username I want to pass whole row object so I can read and use further the coming data.

1 Answer, 1 is accepted

Sort by
0
Eyup
Telerik team
answered on 14 Jun 2016, 05:47 AM
Hi,

You can achieve this requirement using the following approach:
columns.Bound(p => p.ProductName).Title("ProductName").Groupable(true).ClientTemplate("<a style='cursor:pointer' onclick='EditProductDataObject(this);'>#=ProductName#</a>");
JavaScript:
function EditProductDataObject(linkEl) {
    var row = $(linkEl).closest("tr");
    var dataItem = $("#grid").data("kendoGrid").dataItem(row);
    alert(dataItem.ProductName);
}

That should do the trick. Please give it a try and let me know if it works for you.

Regards,
Eyup
Telerik
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
Tags
Grid
Asked by
MV
Top achievements
Rank 1
Answers by
Eyup
Telerik team
Share this question
or