Reputation: 878
I want to use template binding like below but its not working for me, can you please suggest whats wrong?
<div id="gridClientsOutside" data-bind="kendoGrid: { data: FilteredClients, columns: [ { field: 'ClientName', title : 'Client Name' }, { field: 'ClientCode', title: 'Client Code', **template:'<input type='button' value ='#= ClientCode #'></input>**' } ], scrollable: false, sortable: true, pageable: false }">
</div>
Upvotes: 5
Views: 3761
Reputation: 114792
You would want to escape your quotes like:
<div id="gridClientsOutside" data-bind="kendoGrid: { data: FilteredClients, columns: [ { field: 'ClientName', title : 'Client Name' }, { field: 'ClientCode', title: 'Client Code', template: '<input type=\'button\' value=\'#= ClientCode #\' />' } ], scrollable: false, sortable: true, pageable: false }">
</div>
Sample here: http://jsfiddle.net/rniemeyer/zeQMT/
Upvotes: 4
Reputation: 1637
I am unfortunately 3 rep away from being able to comment on the question, which is perhaps the better place for this. Here are my thoughts:
It is not clear exactly what is not working (especially without a jsfiddle or something similar of the problem), but those asterisks before and after template would cause it to fail because the bindings do not accept a **template parameter, although they may have just been added for the question.
Also, your quotes inside the actual value for template are not escaped which may be causing an issue - again, the question needs to clarify what exactly is not working, ideally with a jsfiddle of the problem.
Upvotes: 0