kendo grid column: how to data bind click event in

2019-07-16 07:47发布

Kendo Grid columns' data-bind click event in the footer template is not working.

Please see the example http://dojo.telerik.com/ALAZo

The click event on column template for price is working fine but not for the footer template for the same.

Any resolution which uses MVVM binding would be greatly appreciated

标签: kendo-ui grid
2条回答
萌系小妹纸
2楼-- · 2019-07-16 07:54

By default, the header and footer of the Grid are not bound to the ViewModel. A workaround is to find the footer with an appropriate jquery selector after the grid has been initialised and then bind it manually. So something like this:

kendo.bind($("body"), viewModel);
kendo.bind($("#grid").find(".k-grid-footer"), viewModel);

Here I've added id="grid" to your grid declaration like so in order to find it:

<div id="grid" data-role="grid" data-bind="source:dataSource"
查看更多
Root(大扎)
3楼-- · 2019-07-16 07:58

I have reworked your example in order to get a solution where click event works on both column and footer template.

<a onclick='test()'... seems to do the trick.

查看更多
登录 后发表回答