Hosting sfMultiColumnCombox in sfDataGrid

Hello,


I have requirement to display dropdwon of items in two columns within sfDtaGrid but sfDataGrid does not have sfMultiColumnCombox column type. 


Is there a way to host  sfMultiColumnCombox in sfDataGrid or implement this  requirement?


Thanks in advance for usual assistance


Best regards,

Paul Aziz



12 Replies

BT Balamurugan Thirumalaikumar Syncfusion Team October 4, 2021 06:09 AM UTC

Hi Paul, 
 
Thank you for contacting Syncfusion support. 
 
We have analyzed your requirement. We have already considered your requirement as “Provide the support for MultiColumnComboBox column” in SfDataGrid and logged feature request for the same. We will implement this feature in any of our upcoming release.   
   
At the planning stage for every release cycle, we review all open features and identify features for implementation based on specific parameters including product vision, technological feasibility, and customer interest. We will let you know when this feature is implemented. We appreciate your patience until then.    
    
Thank you for requesting this feature and helping us define it. We are always trying to make our products better and feature requests like yours are a key part of our product growth efforts.    
     
You can also communicate with us regarding the open features any time using our Feature Report page.     
 
If you have any more specification/suggestions to the feature request, you can add it as a comment in the portal and cast your vote to make it count.   
 
However, we have provided a workaround for displaying the DataGrid in multicolumn mode. 
 
 
Please let us know if you would require any other assistance. we will be always happy to assist you. 
 
Balamurugan Thirumalaikumar  
  
 



PA Paul October 4, 2021 09:11 PM UTC

Hello  Balamurugan,


Thanks for the reply.


I am happy to know that you are planning to add this feature.



Thumbs up.


Best regards,

Paul Aziz



BT Balamurugan Thirumalaikumar Syncfusion Team October 5, 2021 07:01 AM UTC

Hi Paul, 
 
Thanks for the update. We will implement this feature in any of our upcoming release. We will let you once it released. We appreciate your patience until then. 
 
Balamurugan Thirumalaikumar  
  
 



PA Paul replied to Balamurugan Thirumalaikumar January 5, 2022 11:24 AM UTC

Hello Balamurugan, 


I hope you are doing well. 


Is there is any news on  Provide the support for MultiColumnComboBox column” in SfDataGrid ?


Best regards


Paul Aziz



VS Vijayarasan Sivanandham Syncfusion Team January 6, 2022 03:02 PM UTC

Hi Paul,

We regret to inform you that currently we don't have any immediate plan to include the feature “Provide the support for MultiColumnComboBox column” in SfDataGrid. As we mentioned earlier, We will implement this feature in any of our upcoming release.

However, we have provided a workaround for displaying the DataGrid in multicolumn mode. For more information, please refer the below knowledge base documentation link, 
  

Regards, 
Vijayarasan S 



PA Paul replied to Vijayarasan Sivanandham July 9, 2023 06:07 PM UTC

Hello everyone,

This workaround displays multicolumncombo aright.


But input focus gets stuck after combobox close thus prevent user from navigating away from the multicolumncombo column.


Is there a way to filter?

is there also way to automatically display dropdown as the column receives focus.


Thanks for

Best regards,

Paul Aziz



VS Vijayarasan Sivanandham Syncfusion Team July 10, 2023 02:24 PM UTC

Hi Paul,

We are analyzing your requirement of "Requirements in multicolumn combo column in SfDataGrid" and update you with further details on July 12, 2023.

Regards,
Vijayarasan S



VS Vijayarasan Sivanandham Syncfusion Team July 12, 2023 02:14 PM UTC

Paul,


We are still analyzing your requirement of "Requirements in multicolumn combo column in SfDataGrid" and update you with further details on July 14, 2023.



VS Vijayarasan Sivanandham Syncfusion Team July 14, 2023 06:30 PM UTC

Paul,

Currently, we are checking possibilities to achieve your requirement via a workaround. We need some more time to achieve your requirement and we will update you with further details on July 18, 2023.



VS Vijayarasan Sivanandham Syncfusion Team July 17, 2023 07:46 PM UTC

Hi Paul,

Find the responses to your queries below.

Queries

Responses

 

But input focus gets stuck after combobox close thus prevent user from navigating away from the multicolumncombo column.

 


The reported problem occurs due to the selected value not being updated in the control value. However, you can overcome this by overriding the GetControlValue in GridDropDownDataGridCellRenderer. Refer to the below code snippet,

// Set the value to the cell while end edit or lost focus from the cell

 public override object GetControlValue()

 {

     if (!HasCurrentCellState)

         return base.GetControlValue();

 

     object controlValue;

 

     if (IsInEditing)

     {

         var comboBox = this.CurrentCellRendererElement as ComboDropDown;

         // Set control value from the Text property in ComboBox

         controlValue = comboBox.Text;

     }

     else

         controlValue = this.GetCellValue();

     // Return the control value

     return controlValue;

 }

 

Is there a way to filter?

 


We have loaded the SfDataGrid control as PopupControl in ComboDropDown. Your requirement to filter the combodropdown can be achieved by enabling the AllowFiltering property in SfDataGrid. Refer to the below code snippet,

// Customize the OnInitializeEditElement

protected override void OnInitializeEditElement(DataColumnBase column, RowColumnIndex rowColumnIndex, ComboDropDown uiElement)

{

    Rectangle editorRectangle = GetEditorUIElementBounds();

    uiElement.Size = editorRectangle.Size;

    uiElement.Location = editorRectangle.Location;

    uiElement.DropDownWidth = 200;

 

    SfDataGrid dropDownDataGrid = new SfDataGrid()

    {

        // Enable the filtering in the DropDownDataGrid

        AllowFiltering = true,

        DataSource = (column.GridColumn as GridDropDownDataGridColumn).DataSource,

    };          

   

    uiElement.PopupControl = dropDownDataGrid;

    uiElement.DropDownStyle = ComboBoxStyle.DropDownList;

 

    // Get the current row data

    var dataRow = column.GetType().GetProperty("DataRow", BindingFlags.Instance | BindingFlags.NonPublic).GetValue(column) as DataRowBase;

 

    // Assign the value to the DropDownDataGrid cell

    uiElement.Text = (dataRow.RowData as OrderDetails).ShipCityID.ToString();

 

    // Get the selected item from the DropDownDataGrid

    var selectedItem = dropDownDataGrid.View.Records.First(x=>(x.Data as ShipCityDetails).ShipCityID == (dataRow.RowData as OrderDetails).ShipCityID) ;

    // Set the selected item to the DropDownDataGrid

    dropDownDataGrid.SelectedItem = selectedItem.Data;

   

    this.TableControl.Controls.Add(uiElement);

    uiElement.Focus();

    uiElement.DroppedDown = true;

    base.OnInitializeEditElement(column, rowColumnIndex, uiElement);          

 

    // Wire up the DropDownDataGrid events

    dropDownDataGrid.SelectionChanged += OnDropDownDataGridSelectionChanged;

    dropDownDataGrid.FilterPopupShown += OnDropDownDataGridFilterPopupShown;

    dropDownDataGrid.FilterChanged += OnDropDownDataGridFilterChanged;

}


Note: The provided solution is just a workaround to achieve your requirement with some limitations.

 

s there also way to automatically display dropdown as the column receives focus.

 


Your requirement to automatically display dropdown as the column receives focus can be achieved by setting the SingleClick value as EditMode property and enabling the DroppedDown property in the OnInitializeEditElement method. Refer to the below code snippet,

// Enable the SingleClick editing in SfDataGrid

 sfDataGrid.EditMode = EditMode.SingleClick;

// Customize the OnInitializeEditElement

 protected override void OnInitializeEditElement(DataColumnBase column, RowColumnIndex rowColumnIndex, ComboDropDown uiElement)

 {

     Rectangle editorRectangle = GetEditorUIElementBounds();

     uiElement.Size = editorRectangle.Size;

     uiElement.Location = editorRectangle.Location;

     uiElement.DropDownWidth = 200;

 

     SfDataGrid dropDownDataGrid = new SfDataGrid()

     {

         // Enable the filtering in the DropDownDataGrid

         AllowFiltering = true,

         DataSource = (column.GridColumn as GridDropDownDataGridColumn).DataSource,

     };          

    

     uiElement.PopupControl = dropDownDataGrid;

     uiElement.DropDownStyle = ComboBoxStyle.DropDownList;

 

     // Get the current row data

     var dataRow = column.GetType().GetProperty("DataRow", BindingFlags.Instance | BindingFlags.NonPublic).GetValue(column) as DataRowBase;

 

     // Assign the value to the DropDownDataGrid cell

     uiElement.Text = (dataRow.RowData as OrderDetails).ShipCityID.ToString();

 

     // Get the selected item from the DropDownDataGrid

     var selectedItem = dropDownDataGrid.View.Records.First(x=>(x.Data as ShipCityDetails).ShipCityID == (dataRow.RowData as OrderDetails).ShipCityID) ;

     // Set the selected item to the DropDownDataGrid

     dropDownDataGrid.SelectedItem = selectedItem.Data;

    

     this.TableControl.Controls.Add(uiElement);

     uiElement.Focus();

     uiElement.DroppedDown = true;

     base.OnInitializeEditElement(column, rowColumnIndex, uiElement);          

 

     // Wire up the DropDownDataGrid events

     dropDownDataGrid.SelectionChanged += OnDropDownDataGridSelectionChanged;

     dropDownDataGrid.FilterPopupShown += OnDropDownDataGridFilterPopupShown;

     dropDownDataGrid.FilterChanged += OnDropDownDataGridFilterChanged;

 }


UG Link: https://help.syncfusion.com/windowsforms/datagrid/editing#entering-into-edit-mode


Find the modified sample in the attachment.

Regards,
Vijayarasan S

If this post is helpful, please consider Accepting it as the solution so that other members can locate it more quickly.


Attachment: Modified_Sample_fbf07c9a.zip


PA Paul replied to Vijayarasan Sivanandham July 18, 2023 12:07 PM UTC

Hello Vijayarasan,


Thank you for the assistance. I will review your suggestion and revert back to you asap.


Regards,

Paul Aziz



DM Dhanasekar Mohanraj Syncfusion Team July 19, 2023 10:17 AM UTC

Paul,

We will wait to hear from you. Please let us know if you require any further assistance. We will be happy to assist you.


Loader.
Up arrow icon