Checkbox on header column

I have a checkbox on header column of GGC , but the style of checkbox header column diffirence from other column , how can fix four column with checkbox on header have the same style of first column


5 Replies

AR Arulpriya Ramalingam Syncfusion Team November 15, 2017 12:25 PM UTC

Hi Truong,   
   
Thanks for using Syncfusion products.   
   
By default, cell styles are drawn based on its CellType and GridVisualStyles settings. The bottom border of header in Metro theme will be drawn for the GridColumnHeader cell types only. So that CheckBox appearance in header cell looks different from other columns. In order to change the appearance CheckBox in header cells as same as Header CellType in Metro theme, the QueryCellStyleInfo event can be used. In that event, the Bottom and Right borders for the CheckBox cell can be drawn manually by using the Borders property of GridStyleInfo. Moreover, the BackColor and the CellAppearance properties can be used to set the Checkbox cell appearance as GridColumnHeaderCell. We have created a simple sample as per your requirement. Please make use of below code and sample,   
   
Code example:   
   
//Event Triggering   
this.gridGroupingControl1.QueryCellStyleInfo += newGridTableCellStyleInfoEventHandler(gridGroupingControl1_QueryCellStyleInfo);   
   
//Event Customization   
void gridGroupingControl1_QueryCellStyleInfo(object sender,GridTableCellStyleInfoEventArgs e)   
{   
    if (e.TableCellIdentity.TableCellType == GridTableCellType.ColumnHeaderCell    
        && this.gridGroupingControl1.GridVisualStyles == GridVisualStyles.Metro   
        && e.TableCellIdentity.Column.Name == "ColumnName")   
    {   
        e.Style.CellType = "CheckBox";   
        e.Style.CellValueType = typeof(bool);   
        e.Style.Description = "ColumnName";   
        e.Style.CellValue = CheckBoxValue;   
        e.Style.BackColor = Color.White;   
        //Metro border color   
        Color metroColor = Color.FromArgb(94, 171, 222);   
        //Right border color   
        Color rightBorder = Color.FromArgb(215, 215, 215);   
        e.Style.Borders.Bottom = new GridBorder(GridBorderStyle.Solid, metroColor ,GridBorderWeight.ExtraThick);   
        e.Style.Borders.Right = new GridBorder(GridBorderStyle.Solid, rightBorder,GridBorderWeight.Thin);   
        e.Style.CellAppearance = GridCellAppearance.Flat;   
    }   
    e.Handled = true;   
}   
   
   
Screenshot   
     
   
   
Regards,   
Arulpriya   



TR Truong October 15, 2018 08:08 AM UTC

Hi Arulpriya Ramalingam
First , thank you for helping me. It was so good.

Now i have problem when check at checkbox on a cell , which column having filter ( using Excel filter ). The filter do not working. It prevent filter.


AA Arulraj A Syncfusion Team October 17, 2018 05:11 PM UTC

Hi Truong,  

Thanks for your patience.  

By default, GridGroupingControl does not have the support to load the Excel filter in column headercell when header celltype as CheckBox. Because cell renderers are different for CheckBox cell type and ColumnHeaderCell. So, you cannot use the both renderers for single cell at a time.  
So, We would suggest to use our SfDataGrid to achieve your requirement. This control is more effective compare than GridGroupingControl and you can find the below UG link to know about the SfDataGrid,  


Please refer the below UG link to add the checkbox with filter icon in column header cell,  

Also, you can find the difference between the SfDataGrid and GridGroupingControl from below link,  

Please let us know if you have any other concerns. 

Arulraj A 



TR Truong October 18, 2018 08:34 AM UTC

Hi Arulraj A,

First, thank for your helping me.

You misunderstood me. I do not need to add filter in column header of checkbox column. My problem here is when i check/uncheck of a checkbox , Filter can working anymore.

I have some question

Question one:  when i check/uncheck of a checkbox then click on Filter, that checkbox do not check/uncheck, but when i check/uncheck of a checkbox , then click on another row it woriking normal.

Question two: when i check/uncheck of a checkbox, then click on Filter, chose a text  then press OK button, nothing happen, the grid does not reload record match with Filter value.


Question three: after edit text from RichTextBox(in DropDown)then click on button Save, the Value of RichTextBox of that cell change into strange text.
In this image below, the text change into {\rtf1\ansi.........

Question four: How to clear all Filter of all column ( i need to reload Table ).




AA Arulraj A Syncfusion Team October 18, 2018 04:29 PM UTC

Hi Truong,  
  
Thanks for your update.  
   
Query  
Response  
when i check/uncheck of a checkbox, then click on Filter, chose a text  then press OK button, nothing happen, the grid does not reload record match with Filter value.  
We can reproduce the reported scenarios and we have confirmed this is a bug. So, we have logged the bug report for this issue “ExcelFilter misbehaves while adding the checkbox column in GridGroupingControl”. It will be available on our next main release 2018 Volume 3 SP1 which is planned to release at the end of October 2018.  
after edit text from RichTextBox(in DropDown)then click on button Save, the Value of RichTextBox of that cell change into strange text.  
In this image below, the text change into {\rtf1\ansi.........  
  
How to clear all Filter of all column ( i need to reload Table )  
To clear all the filters for GridGroupingControl, you could use theRecordFilters.Clear method. Please refer the following code example and the UG link,  
  
Code example  
this.gridGroupingControl1.TableDescriptor.RecordFilters.Clear();  
  
  
Regards, 
Arulraj A 


Loader.
Up arrow icon