How to prevent Kendo Grid click propagation

时间:2015-07-13 21:00:18

标签: kendo-ui kendo-grid

I need to add an image to one specific column, so I have something like that, This is good, I see the image, I just added am alert to see how is working. My problem is that after showing the alert, is executing the sorting. Is there a way to avoid the sorting when I just click on my image?

{
    field: "ShipName", headerTemplate: "<a class='k-link pull-left' href='#'>Charge</a><img onclick='alert(1)' src='http://localhost/MyApp/images/Reports/filterApplied.png' title='this is a filter'/>",
    title: "Ship Name"
}

2 个答案:

答案 0 :(得分:1)

如果您不希望对该特定列进行排序,请在网格配置中将其禁用。 API Reference

答案 1 :(得分:0)

尝试添加return false;,其作用类似于e.preventDefault()

onclick='alert(1); return false;'