We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

checkbox template EJ2 Grid

Thread ID:

Created:

Updated:

Platform:

Replies:

141202 Nov 29,2018 12:14 PM UTC Nov 30,2018 04:29 AM UTC ASP.NET Core - EJ 2 3
loading
Tags: DataGrid
Costa
Asked On November 29, 2018 12:14 PM UTC

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.


Madhu Sudhanan P [Syncfusion]
Replied On November 29, 2018 12:23 PM UTC

Hi Costa, 

Thanks for contacting Syncfusion support. 

The template placeholder is used incorrectly in the code which is the cause of the issue. Please modify your template as follows. 


  <script type="text/x-jsrender" id="isInRoleTemplate"> 
   <input id="isInRoleCheckbox" type="checkbox"  ${if (UserIsInRole)} checked ${/if} /> 
 </script> 


For more information on using template engine and its syntax please refer the below link. 


Regards, 
Madhu Sudhanan P 


Costa
Replied On November 29, 2018 01:37 PM UTC

Thanks!

Madhu Sudhanan P [Syncfusion]
Replied On November 30, 2018 04:29 AM UTC

Hi Costa,  

Thanks for the update. Please get back to us if you require further assistance.  

Regards,  
Madhu Sudhanan P 


CONFIRMATION

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.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

;