Thread ID: |
Created: |
Updated: |
Platform: |
Replies: |
142049 | Jan 16,2019 03:21 PM UTC | Jan 21,2019 12:00 PM UTC | ASP.NET MVC | 5 |
![]() |
Tags: TreeGrid |
<script type="text/x-jsrender" id="customColumnTemplate">
<div style='padding-left:5px;'>{{if Approved}}<input type="checkbox" class="customCheckbox" checked>{{else}}<input type="checkbox" class="customCheckbox" />{{/if}}</div>
</script>
@(Html.EJ().TreeGrid("TreeGridContainer")
.Columns(co =>
{
//.. co.Field("Approved").HeaderText("Approved").IsTemplateColumn(true).TemplateID("customColumnTemplate").EditType(TreeGridEditingType.Boolean).Width(30).Add();
})
)
<script>
$("#TreeGridContainer").on("change", ".customCheckbox", function (e) {
var $tr = $(e.target).closest('tr'),
treeObj = $("#TreeGridContainer").data("ejTreeGrid"),
checkStatus = $(e.target).is(':checked'),
rowIndex = treeObj.getRows().index($tr),
record = treeObj.model.currentViewData && treeObj.model.currentViewData[rowIndex];
//to update all the record collection
record.Approved = record.item.Approved = checkStatus;
});
</script> |
This post will be permanently deleted. Are you sure you want to continue?
Sorry, An error occured while processing your request. Please try again later.
This page will automatically be redirected to the sign-in page in 10 seconds.