Hi. I can't get the column template to work with the checkbox in the EJS grid:
<script type="text/x-jsrender" id="isInRoleTemplate">
<input id="isInRoleCheckbox" type="checkbox" {{if UserIsInRole}} checked {{/if}} onclick="isInRoleCheckbox_click(this)" />
</script>
@{
List<object> commands = new List<object>();
commands.Add(new { type = "Edit", buttonOption = new { iconCss = "e-icons e-edit", cssClass = "e-flat" } });
commands.Add(new { type = "Delete", buttonOption = new { iconCss = "e-icons e-delete", cssClass = "e-flat" } });
commands.Add(new { type = "Save", buttonOption = new { iconCss = "e-icons e-update", cssClass = "e-flat" } });
commands.Add(new { type = "Cancel", buttonOption = new { iconCss = "e-icons e-cancel-icon", cssClass = "e-flat" } });
}
<ejs-grid id="gridRoles" width="600" height="500" allowPaging="true" allowResizing="true" allowSorting="true"
allowFiltering="true"
toolbar="@(new List<string>() {"Search", "Add"})"
load="onGridRolesLoad" actionComplete="roleActionComplete" actionFailure="roleActionFailure">
<e-data-manager adaptor="UrlAdaptor" url="Admin/Roles_Read" insertUrl="Admin/Role_Add" updateUrl="Admin/Role_Update"
removeUrl="Admin/Role_Delete"></e-data-manager>
<e-grid-editsettings allowEditing="true" mode="Dialog" template="#RoleDialogTemplate" allowAdding="true" allowDeleting="true"></e-grid-editsettings>
<e-grid-filterSettings type="Excel"></e-grid-filterSettings>
<e-grid-pagesettings pageSize="10"></e-grid-pagesettings>
<e-grid-columns>
<e-grid-column field="UserIsInRole" allowEditing="false" template="#isInRoleTemplate" width="90" headerText="isInRole"></e-grid-column>
<e-grid-column field="Name" headerText="Role" textAlign="Left" width="120"></e-grid-column>
<e-grid-column field="Id" width="150" isPrimaryKey="true" headerText="Id" allowEditing="false"></e-grid-column>
<e-grid-column width="100" commands="commands"></e-grid-column>
</e-grid-columns>
</ejs-grid>
Everything works as expected, except for the column with the template (UserIsInRole).
What am I doing wrong? If you can-an example.
Thanks.