How to Select Multiple Items in a Dropdown List of cell in GridGroupingControl

How to Select Multiple Items in a Dropdown List in GridGroupingControl

I have a setup where a cell in the GridGroupingControl displays a dropdown list. The issue is that this list only allows selecting a single value. Now, I want to modify it so that the dropdown includes checkboxes, allowing me to select multiple items freely.

Below is my initial code and an illustrative image.


DataTable dt = new DataTable();

private void CreateDataTableMaChamCongDTO()

{

dt = new DataTable();

dt.Columns.Add("Mã chấm công", typeof(System.String));

dt.Columns.Add("Tên chấm công", typeof(System.String));

dt.Columns.Add("Tỷ lệ tính lương", typeof(System.Decimal));

dt.Columns.Add("Tỷ lệ trừ phép", typeof(System.Decimal));


foreach (var row in Data.MaChamCongDTO)

{

dt.Rows.Add(row.MaChamCong_ud, row.MaChamCong_nm, row.TyLeTinhLuong, row.TyLeTruPhep);

}

}


grd.TableDescriptor.VisibleColumns.Add(columnName);

grd.TableDescriptor.Columns[columnName].HeaderText = _header;

grd.TableDescriptor.Columns[columnName].Width = 50;

grd.TableDescriptor.Columns[columnName].Appearance.AnyRecordFieldCell.CharacterCasing = CharacterCasing.Upper;


//Assigning the column cell types as GridListControl

grd.TableDescriptor.Columns[columnName].Appearance.AnyRecordFieldCell.CellType = GridCellTypeName.GridListControl;

//Enables Autocomplete

grd.TableDescriptor.Columns[columnName].Appearance.AnyRecordFieldCell.AutoCompleteInEditMode = GridComboSelectionOptions.AutoSuggest;

grd.TableDescriptor.Columns[columnName].Appearance.AnyRecordFieldCell.ShowButtons = GridShowButtons.ShowCurrentCell;

//Add DataSource

grd.TableDescriptor.Columns[columnName].Appearance.AnyRecordFieldCell.DataSource = dt;

grd.TableDescriptor.Columns[columnName].Appearance.AnyRecordFieldCell.DisplayMember = "Mã chấm công";

grd.TableDescriptor.Columns[columnName].Appearance.AnyRecordFieldCell.ValueMember = "Mã chấm công";

multichoice.png


8 Replies

MS Malini Selvarasu Syncfusion Team February 19, 2025 02:03 PM UTC

Hi Tru?ng Ph?m,

Based on the information provided, we understand that you require a multi-select dropdown list in GridGroupingControl. Currently, GridGroupingControl does not natively support this feature. However, you can achieve the desired functionality by customizing the dropdown through an overridden dropdown renderer.
To assist you further, we have prepared a sample demonstrating this approach. Please review the sample, and let us know if this solution meets your requirements.
If we have misunderstood your request or if your requirements differ, kindly provide additional details. This will help us better understand your needs and deliver a more tailored solution.
Thank you for your cooperation and understanding.
Regards,
Malini Selvarasu

Attachment: GridGroupingControl_Demo_4b384745.zip


SL School Liter replied to Malini Selvarasu February 19, 2025 03:00 PM UTC

Thank you for your help. Although it didn't fully meet 100% of my expectations, it still solved the problem I was struggling with. I really appreciate it.




MS Malini Selvarasu Syncfusion Team February 20, 2025 03:14 PM UTC

Hi School Liter,
We are glad to hear that the provided workaround resolved your issue. If you encounter any further issues or need additional assistance, please feel free to reach out to us. We are always happy to help.
Regards,
Malini Selvarasu


SA Surah Al Waqiah February 24, 2025 09:31 AM UTC

You can achieve multi-selection by using a GridComboBoxListBoxPart with checkboxes or a GridDropDownListCellModel. Setting ExclusiveChoice to false allows multiple selections. Have you tried handling selected values as a comma-separated string?



MS Malini Selvarasu Syncfusion Team February 25, 2025 02:36 PM UTC

Hi Surah Al Waqiah,

Based on the information provided, you have successfully achieved multi-selection using a GridComboBoxListBoxPart.
Could you please share the relevant code snippets demonstrating how you implemented multi-selection? This will help us analyze your scenario and provide a prompt solution.
Thank you for your cooperation.
Regards,
Malini Selvarasu


JG Jane Gracia March 10, 2025 12:48 PM UTC

My problem is also solved, thank you so much.



MS Malini Selvarasu Syncfusion Team March 11, 2025 05:17 AM UTC

Hi Jane Gracia,
We are glad to hear that the provided workaround resolved your issue. If you encounter any further issues or need additional assistance, please feel free to reach out to us. We are always happy to help.
Regards,
Malini Selvarasu


HJ Henry Jack April 13, 2025 06:01 PM UTC

My problem is also solved, thank you so much. scmapk 



Loader.
Up arrow icon