BoldSignA modern eSignature application with affordable pricing. Sign up today for unlimited document usage!
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.
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:
[app.component.html]
<ejs-grid #grid id="grid" [dataSource]='data' [allowPaging]='true' [pageSettings]='pageSettings'> <e-columns> <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> </ng-container> </ng-template> </e-column> </e-columns> </ejs-grid> |
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.
Regards,
Santhosh I
Awesome. That will work. Thank you again!
Hi Eric,
We hope the provided solution helped to solve the issue. Please get back to us fir further assistance.