Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to Pass dataItem to a js function on a KendoGrid cell custom click

I have a KendoGrid that have a column like:

{
      title: "Column1",
      template: <a href="javascript:customJsFunction(#= data #)">click here</a>',
},

..first this code doesnt work. Im trying to pass the whole "data" (the data for the current row) to a javascript function. Thanks in advance.

like image 857
Erick Lanford Xenes Avatar asked Aug 23 '17 20:08

Erick Lanford Xenes


1 Answers

Try this template using JSON.stringify():

"<a href='javascript:customJsFunction(#= JSON.stringify(data) #)'>Click here</a>"

Demo

like image 52
DontVoteMeDown Avatar answered Sep 30 '22 04:09

DontVoteMeDown