HTML:
<div data-bind="koGrid: gridOptions" style="height:600px;border:solid 1px #ccc;"></div>
JS:
Column definitions:
{ field: 'orderCatalogUpdateID', cellTemplate: '<button data-bind="click: $userViewModel.removeItem">X</button>', displayName: ' ', width: '2%' }`
removeItem function on the ViewModel:
self.removeItem = function (item) {
self.list.remove(item);
}
The item
that gets passed to the removeItem
function is not the data item that is bound to the row but rather the KoGrid column. How can I get the data item that is bound to the row so I can pass it to the remove
function on the observable array?
I have tried wiring up click events with jQuery and a variety of cell templates trying to pass in the data item being bound to the row with no success.