Search code examples
javascriptkendo-uikendo-gridkendo-datasource

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.


Solution

  • Try this template using JSON.stringify():

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

    Demo