Query: When you edit a checkbox column, the EndEdit event is not fired.
Solution: As we are using custom column to render checkbox, while check or uncheck it will not fire EndEdit event instead of that bind change event to the checkbox class to validate it.
Note: For custom checkbox column, make sure that column AllowEditing=”false” because when the user double the checkbox, it will changed to text edited state.
Please refer following code snippnet to bind the checkbox event.
<ej:treegrid ID="Treegrid" runat="server" AllowColumnResize="true" AllowSorting="true" ChildMapping="Children" TreeColumnIndex="1" > <Columns> <ej:treegridcolumn HeaderText="Task Id" Field="Id" Width="40" /> //.. . <ej:treegridcolumn HeaderText="Status" AllowEditing="false" Field="Status" IsTemplateColumn="true" TemplateID="customColumnTemplate" /> </Columns> </ej:treegrid> <script type="text/javascript"> $("#Treegrid").on("change", ".customCheckbox", function (e) { e = e || window.event; var targetEle = e.target || e.srcElement, $tr = $(targetEle).closest('tr'), treeObj = $("#Treegrid").data("ejTreeGrid"), checkStatus = $(targetEle).is(':checked'), rowIndex = ($tr).index(), record = treeObj.model.currentViewData && treeObj.model.currentViewData[rowIndex]; record["Status"] = checkStatus; alert( "Saved as " + record.status); }); </script> |
We have also prepared a sample for your reference. Please find the sample in the following URL.
Sample: http://www.syncfusion.com/downloads/support/forum/121637/ze/TreeGridSample_ASP.net1605561559
Related demo URL: http://asp.syncfusion.com/demos/web/treegrid/treegridcolumnfiltering.aspx
Please let us know if you require further assistance on this.
Regards,
Jayakumar Duraisamy