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.
Unfortunately, activation email could not send to your email. Please try again.

DataBind CheckBox Grid Column

Thread ID:

Created:

Updated:

Platform:

Replies:

132366 Aug 28,2017 09:05 PM Sep 18,2018 06:23 AM Angular 6
loading
Tags: ejGrid
Marcelo Blank
Asked On August 28, 2017 09:05 PM

I have a databind DataGrid column  (Active) that is a boolean type (True/False or 1/0) ...

I want to display these column as checkbox, but not select the row ...


These code  for <e-column field="Active" [displayAsCheckBox]= "true"></e-column>  does not work
and these <e-column field="Active" headerText="Ativa" type="checkbox" rowSelected="false" width="50" ></e-column>
select the rows ...

<ej-grid id="g1" [dataSource]="empresas" allowPaging="true"
[toolbarSettings]="toolbarItems" [editSettings]="editSettings" >
<e-columns>
<e-column field="Id" headerText="ID" [isPrimaryKey]="true" ></e-column>
<e-column field="Name" headerText="Company"></e-column>
<e-column field="Nick" headerText="Nick"></e-column>
<e-column field="Active" [displayAsCheckBox]= "true"></e-column>
<e-column field="Active" headerText="Ativa" type="checkbox" rowSelected="false" width="50" ></e-column>
</e-columns>
</ej-grid>

What´s the right way to do these ?


Marcelo Blank
Replied On August 28, 2017 09:08 PM

Follow the grid


Mani Sankar Durai [Syncfusion]
Replied On August 29, 2017 08:31 AM

Hi Marcelo, 

Thanks for contacting Syncfusion support. 

We have analyzed your query and we found that you would like to show the column as checkbox when data is either true/false or 0/1. To achieve this we suggest you to set the type as “boolean” and when the type is “checkbox” it will select the rows when checking the checkbox. 
Refer the code example 
<e-column field=”Active” type=”boolean” [displayAsCheckBox] = “true” /> 

Note: if the checkbox should not select the row when checking don’t use the type as checkbox instead use it as Boolean. 
Refer the documentation link. 

Please let us know if you need further assistance. 

Regards, 
Manisankar Durai. 


Marcelo Blank
Replied On August 29, 2017 08:48 AM

Great Manisankar

Works perfectly...


Regards,

Marcelo



Mani Sankar Durai [Syncfusion]
Replied On August 30, 2017 02:20 AM

Hi Marcelo, 

We are happy to hear that your problem has been solved.  

Please let us know if you need further assistance. 

Regards, 
Manisankar Durai. 


Aditi Patre
Replied On September 18, 2018 01:26 AM

Unable to bind checkbox to a column (which holds boolean value) in a grid.

I'm creating a list of syncfusion grid columns
List<Column> cols = new List<Column>();

Dictionary<string, object> ReadOnlyDict = new Dictionary<string, object>();
 ReadOnlyDict.Add("style", "background-color:#eeeeee");


Adding column of boolean datatype to grid:

cols.Add(new Column() { Field ="ColumnName", HeaderText = "ColumnName", HeaderTooltip ="", Type = "boolean", DisplayAsCheckbox = true, TextAlign = TextAlign.Center, AllowEditing = false, Visible = true, CustomAttributes = ReadOnlyDict});

The grid does display checkbox but it isn't able to bind with the bit datafield. So although the value in database is 0 it is always mapping it as checked.

Seeni Sakthi Kumar Seeni Raj [Syncfusion]
Replied On September 18, 2018 06:23 AM

Hi Aditi,  
 
Based on the given code example, we have prepared a sample in the latest version of the Essential Studio ASP.Net MVC platform. The sample can be downloaded from the following location. 
 
 
We cannot reproduce the reported problem at our end. We have used the 0’s and 1’s as the value for the Boolean column which is binding value to the checkbox correctly. Please share the following details to analyze the problem at our end. 
 
  1. Essential studio version.
  2. Complete code example of the Grid (view and controller page)
  3. Model class of the Grid datasource
  4. Master page and web.config page of the application
  5. If possible, modify the attached sample and reproduce the issue.
 
Regards, 
Seeni Sakthi Kumar S. 


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.

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.

;