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

handling boolean column with true/false or null

Is there a way to have a grid column handle boolean columns with true/false/null values?

By default the grid ignores the displayAsCheckBox property of a column if the grid finds null values in the column.

For example both columns have the displayAsCheckBox set, the first column defaulted has only true or false values and works as expected, the second column valid has true or false or null values and does not work as expected. I'd expect the true column to be checked, the false column to have a empty check box and the null value to display nothing.

3 Replies

SI Santhosh Iruthayaraj Syncfusion Team April 4, 2023 02:59 PM UTC

Hi Eric,

Greetings from Syncfusion support.

We have checked your query and implemented a solution to render the checkbox only for true and false values using ngIf and the column template feature of the Grid, and for null values, nothing is rendered. We suggest using the below code snippet to achieve this:



<ejs-grid #grid id="grid" [dataSource]='data' [allowPaging]='true' [pageSettings]='pageSettings'>


            <e-column field='ProductID' headerText='Product ID' width='120' textAlign='Right'></e-column>

            <e-column field='ProductName' headerText='Product Name' width='150'></e-column>

            <e-column field='Discontinued' headerText='Discontinued' width='130' textAlign='Center'>

                <ng-template #template let-data>

                    <ng-container  *ngIf='data.Discontinued == true || data.Discontinued == false'>

                        <ejs-checkbox [checked]='data.Discontinued' [disabled]='true'></ejs-checkbox>






You can find the sample at the following link:

Sample: https://stackblitz.com/edit/angular-ppdkb4?file=src%2Fapp.component.html

Please feel free to reach out to us if you have any further queries.


Santhosh I

ER eric April 4, 2023 03:45 PM UTC

Awesome. That will work. Thank you again!

SG Suganya Gopinath Syncfusion Team April 5, 2023 02:59 PM UTC

Hi Eric, 

We hope the provided solution helped to solve the issue. Please get back to us fir further assistance.

Live Chat Icon For mobile
Up arrow icon