user3724031
user3724031

Reputation: 245

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

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

Upvotes: 2

Views: 1657

Answers (2)

NigelK
NigelK

Reputation: 8490

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"

Upvotes: 0

Sandman
Sandman

Reputation: 2307

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.

Upvotes: 0

Related Questions