Hello everyone
I have the following bound column set up:
columns.Bound(site => site.SiteHasBin).ClientTemplate("#=dirtyField(data,'SiteHasBin')# #:SiteHasBin#").ClientHeaderTemplate("<a class='k-link'>Bin Present? - Select all</><input style='margin-left:10px;' id='checkAll' type='checkbox' onclick='checkAll(this)' />").Sortable(false);
With the associated js:
function dirtyField(data, fieldName) {
if (data.dirty && data.dirtyFields[fieldName]) {
return "<span class='k-dirty'></span>"
}
else {
return "";
}
}
function checkAll(input) {
var grid = $("#gridBins").data("kendoGrid");
var items = grid.items();
items.each(function () {
var dataItem = grid.dataItem(this);
if (dataItem.SiteHasBin != input.checked) {
dataItem.SiteHasBin = input.checked;
}
dataItem.dirty = true;
})
grid.saveChanges();
grid.dataSource.sync();
}
However, I cannot for the life of me get the cell into it's dirty state properly which would then allow me to use the Save functionality.
As you can see from the above. It updates the values accordingly but unlike single clicking, doesn't dirty the cell / data item.
Could someone point me in the right direction please?
Rich