Can someone please provide me with a few lines of code to get the value of a checkbox in a column in a Kendo Grid. Starting with this code:
columns.Bound(o => o.Resolved).ClientTemplate(" <input type='checkbox' # if (Resolved) { #checked='checked'# } #/>").Title("Resolved").Width(60).Sortable(false);
var data = $("#Appointments").data("kendoGrid").dataSource.data();
$.each(data, function (index, item)
{ trArray = { "Resolved": item.Resolved <<--- This gives me the value IN THE MODEL --- I WANT WHAT THE USER HAS SELECTED! }; });
Please don't send me a solution that hangs Visual Studio for an answer.
Thanks,
columns.Bound(o => o.Resolved).ClientTemplate(" <input type='checkbox' # if (Resolved) { #checked='checked'# } #/>").Title("Resolved").Width(60).Sortable(false);
var data = $("#Appointments").data("kendoGrid").dataSource.data();
$.each(data, function (index, item)
{ trArray = { "Resolved": item.Resolved <<--- This gives me the value IN THE MODEL --- I WANT WHAT THE USER HAS SELECTED! }; });
Please don't send me a solution that hangs Visual Studio for an answer.
Thanks,
Hi All,
I have the similar query, I have a kendo grid with Checkbox(Templete) and ID, On click of delete all button i want the id of the record which is checked, Could you please help me on this?
Hi Rajendra,
This is demonstrated in the following article:
Namely:
{ template: '#=dirtyField(data,"Discontinued")#<input type="checkbox" #= Discontinued ? \'checked="checked"\' : "" # class="chkbx k-checkbox" />', width: 110 }, ... $("#grid .k-grid-content").on("change", "input.chkbx", function(e) { var grid = $("#grid").data("kendoGrid"), dataItem = grid.dataItem($(e.target).closest("tr")); console.log(dataItem.id) dataItem.set("Discontinued", this.checked); })
I hope this helps.
Regards,
Nikolay