Я использую K-кнопку в Kendo Grid.Для окраски каждой строки я должен был использовать параметры rowTemplate и altRowTemplate.единственная проблема состоит в том, что функция щелчка не связывается должным образом с кнопками.
Я получаю следующую ошибку,
(индекс): 1 Uncaught ReferenceError: viewProfile не определен вHTMLButtonElement.onclick ((index): 1)
Код здесь,
myGridOptions({
columns: [
{ field: 'name', title: 'Name', width: '160px'},
{ field: 'address', title: 'address'},
{ field: 'occupation', title: 'Occupation' },
{ field: 'location', title: 'Location'},
{ field: 'salary', title: 'Salary' },
{ field: 'company', title: 'Company'},
{ field: 'phone', title: 'Phone'},
//{ field: 'button', title: ' ' }
{ command: { text: 'View Profile', click: viewProfile }, title: ' ', width: '160px' }
],
dataSource: OccData,
rowTemplate: '<tr style="background-color: rgb(246,246,246)" data-uid="#= uid #">'+
'<td>#: name # </td>' +
'<td>#: address #</td>' +
'<td>#: occupation #</td>' +
'<td>#: location #</td>' +
'<td>#: salary #</td>' +
'<td>#: company #</td>' +
'<td> #: phone#</td>' +
'<td>#: education #</td>' +
'<td><button class="k-button" onclick="viewProfile();">View Profile</button></td>'+
'</tr>',
altRowTemplate: '<tr style="background-color: rgb(255,255,255)" data-uid="#= uid #">'+
'<td>#: name # </td>' +
'<td>#: address #</td>' +
'<td>#: occupation #</td>' +
'<td>#: location #</td>' +
'<td>#: salary #</td>' +
'<td>#: company #</td>' +
'<td> #: phone#</td>' +
'<td>#: education #</td>' +
'<td><button class="k-button" onclick="viewProfile();">View Profile</button></td>'+
'</tr>',
overflow: false
});
Я ссылался на несколько ссылок, но не смог найти решение использовать функцию щелчка в rowTemplate.
Любое предложение от разработчиков Kendo !!будет полезно для меня.