Hi Customer,
Greetings from Syncfusion Support.
QUERY: Display checkbox in the first column of grid with dynamic values
From your query we understand that you need to have checkbox as one of the column of grid. This can be achieved by creating column with type as “checkbox”. Please check the below help documentation,
Also if you have one of column in your data as Boolean type and if you need to render checkbox column with those Boolean data, you can use the property “displayAsCheckbox” set to true.
Please check the below help documentation,
Please check the below code snippet,
<div class="cols-sample-area">
<?php
$col1 = new EJ\Grid\Column();
$col1->type('checkbox')->headerText("Column with type as checkbox")->width(70);
$col2 = new EJ\Grid\Column();
$col2->field("Verified")->headerText("Boolean column displayed as checkbox")->displayAsCheckbox(true)->width(70);
$col3 = new EJ\Grid\Column();
$col3->field("help_topic_id")->headerText("OrderID")->isPrimaryKey(true)->textAlign("right")->width(100);
$gridColumns = array($col1,$col2,$col3);
echo $grid -> dataSource($dataManager)->columns($gridColumns)->allowPaging(true)render();
?>
</div> |
In the above sample, “Verified” column is Boolean column.
If you need checkbox just to select rows, you can use column with type as “checkbox”. If you need to edit, save (i.e change) the values of checkbox, you can use displayAsCheckbox property with your Boolean column.
If your requirement is different from the above mentioned solutions, please explain your requirement in detail. Also share us the below details,
- Complete grid rendering code
- Version details
If you have further queries, please get back to us.
Regards,
Gowri V L.