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: June 24, 2019).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

how to Integrate checkbox with dynamic value in specific grid column.

Thread ID:

Created:

Updated:

Platform:

Replies:

150913 Jan 24,2020 05:11 AM UTC Feb 3,2020 09:18 AM UTC PHP 3
loading
Tags: Grid
Dev Ops
Asked On January 24, 2020 05:11 AM UTC

Hello,

can anyone have some ideas about how can i display checkbox in grid column with dynamic value.

Thanks.

Gowri Loganathan [Syncfusion]
Replied On January 27, 2020 12:02 PM UTC

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,  
  1. Complete grid rendering code
  2. Version details

If you have further queries, please get back to us. 

Regards, 
Gowri V L. 


Ishan Shah
Replied On January 31, 2020 06:02 AM UTC

Hello, I have one idea, which is in the following code :

<?php 
    //Write the query
    $sql = "SELECT `name` FROM Students";

    //Run the query
    $query_resource = mysql_query($sql);

    //fetch the result
    while( $student = mysql_fetch_assoc($query_resource) ):
?>

    <span><?php echo $student['name']; ?></span>
    <input type="checkbox" name="student[]" value="<?php echo $student['name']; ?> /><br />

<?php endwhile; ?>


The example works these things to actually function properly:

You're using the Mysql server or SQL server and your student table must give records when querying on that table.

Gowri Loganathan [Syncfusion]
Replied On February 3, 2020 09:18 AM UTC

Hi Ishan, 
 
Thanks for the update.  
 
Please get back to us if you need further assistance from us. 
 
Regards, 
Gowri V L. 


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

Live Chat Icon For mobile
Live Chat Icon