Hi,
I am using Kendo Grid and I have created a checkbox that is read-only as default. The checkbox will only enable after user has edited the row.
I am developing this function in onChange by using "$('.chkbx').prop('disabled', false);" to remove the disabled attribute of checkbox but it will enable all the checkbox in the grid instead of edited row.
I have retrieved grid, recno and data item of current row in onChange. May I know is that possible to remove the disabled attribute of checkbox by using these information I retrieved? Or even better if could based on condition of dirty flag, so that if user has removed the value they changed, the checkbox can revert back to disabled.
Thanks in advance.
Here is my code:
model: {
id: "recno",
fields: {
DEupdateFlag: { type: "boolean" },
recno: { editable: false, validation: { required: true } },
custname: { editable: true}
}
}
columns: [
{
template: '<
input
type
=
"checkbox"
disabled
=
"disabled"
#= DEupdateFlag ? \'
checked
=
"checked"
\' : "" #
class
=
"chkbx"
/>',
width: 70,
headerTemplate: '<
b
>Action</
b
>',
headerAttributes: { style: "text-align:center" },
attributes: {
"class": "table-cell",
style: "text-align: center"
}
},
{ field: "recno", title: "Recno", width: 66, filterable: true },
{ field: "custname", title: "Customer Name", width: 85, editor: TextEditor, filterable: true }
]
function onChange{e){
if (e.action == "itemchange") {
var grid = $("#mainGrid").data("kendoGrid");
var recno = e.items[0].recno;
var dataItem = grid.dataSource.get(recno);
$('.chkbx').prop('disabled', false);
}
}