I'm trying to achieve something that I thought was rather simple...
- A kendo Grid bound to a viewModel with a collection of quotes
- Each row in the grid must have a list of actions much like Sitefinity's Pages section, i.e. each page has a list of actions
- The first action in a row loads the quote in a different SPA view which works because we make use of the Url property of the menuButtons button
- The second action is supposed to download a PDF which we're trying to do by binding the click event of the button which is where things go wrong
Note: We could probably achieve this using the router's handler, but I'm hoping to avoid that approach.
If I put a click handler on the menuButton or after the row "type: 'splitButton' it can never find the handler. The same goes for the entire toolbar click handler as can be seen in the examples below.
I also thought of creating a second template that will be called by the first template in which I would create a button and again try binding a click handler.
Problems
When I try to bind directly to any of the click handlers I get a JS handler error coming from Kendo like it can't find the defined handler. "TypeError: handler is not a function - kendo.all.js (line 10790, col 20)"
When I try the templates approach I keep getting a ​Invalid Template exception.
<script id="gridRowActionItem" type="text/x-kendo-template"> <a href="#" data-bind="events: { click: rowItemInToolbarClicked }">Click Me</a></script><script id="gridRowActions" type="text/x-kendo-template"> <div id="toolbar" data-role="toolbar" data-items='[ { type: "splitButton", text: "Continue", menuButtons: [ { text: "Continue Quote", url: "\\#/quote/step1/#:data.quoteId#" }, { text: "Download PDF" } ] }, { template: kendo.template($("#gridRowActionItem").html()) } ]' data-bind="events:{click: OnActionsClick}"> </div></script> <div id="quotes" data-role="grid" data-bind="source: quotes" data-editable="true" data-columns="[ { 'field': 'description' }, { 'field': 'status'}, { 'field': 'broker', 'title': 'Broker}, { 'field': 'date', 'title': 'Date}, { template: kendo.template($('#gridRowActions').html()) }]"></div>