kendo grid column: how to data bind click event in footer template?

☆樱花仙子☆ 提交于 2019-12-11 00:26:52

问题


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


回答1:


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"



回答2:


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.



来源:https://stackoverflow.com/questions/44300793/kendo-grid-column-how-to-data-bind-click-event-in-footer-template

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!