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. Image for the cookie policy date
Unfortunately, activation email could not send to your email. Please try again.
Essential JS2

Syncfusion jQuery based widgets are no longer in active development. Switch to our pure JavaScript based next generation Essential JS 2 library.

Syncfusion Feedback

How to add custom column with check box

In Gantt, user can display checkbox column by using load client side event and column template support. The below code snippet explains initializing a custom column with checkbox and saving the editing changes to the data source.

Code snippets:

<div id="gantt"></div>  
<script type="text/x-jsrender" id="customColumnTemplate">
<div style="margin-left:20px;">{{if State}} <input class="customCheckbox" type="checkbox" checked="checked" value="" />{{else}} <input class="customCheckbox" type="checkbox" value="" />{{/if}}</div>
        var projectData = [{
            taskID: 1,
            taskName: "Planning",
            startDate: "02/03/2014",
            endDate: "02/07/2014",
            progress: 100,
            duration: 5,
            state: true,
            subtasks: [{
                taskID: 2,
                taskName: "Plan timeline",
                startDate: "02/03/2014",
                endDate: "02/07/2014",
                duration: 5,
                state: true,
                progress 100
        $(function() {
                dataSource: projectData,
                beginEdit: beginEdit,
                load: function() {
                    var columns = this.getColumns();
                    columns.splice(4, 0, {
                        field: "state",
                        headerText: "State",
                        isTemplateColumn: true,
                        templateID: "customColumnTemplate",
                        width: "80px",
        // To prevent the string edit while editing check box
        function beginEdit(args) {           
            var columnIndex = args.columnIndex;
            if (columnIndex == 4) {
                args.cancel = true;
        //Get checked row and select or unselect corresponding records
        $("#gantt").on("change", ".customCheckbox", function (e) {
                var $tr = $(e.target).closest('tr'),
                    ganttObj = $("#gantt").data("ejGantt"),
                    checkStatus = $(e.target).is(':checked'),
                    $gridRows = ganttObj.getRows(),
                    rowIndex = $gridRows.index($tr),
                    record = ganttObj.model.currentViewData &&    
                    record["state"] = checkStatus;


The below screen shot depicts the above code example

Add custom column with checkbox.

Sample link

A sample to add custom column with checkbox is available in the following link, Sample

You must log in to leave a comment

Please sign in to access our KB

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

Up arrow icon

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

Live Chat Icon For mobile