Sample request - MultiColumnComboBox in GridGroupingControl

Is there anyone that can provide a simple implementation of such solution? I found many obsolete articles regard this problem but none that can work on recent frameworks.

Later Edit: main issue is how to set different source for each combobox based on the value selected on the adjacent cell. Scenario could be like this: I select product category (in grid based on the combobox selection) and now I want to select product based on category selected before. Any idea?

Thanks a lot,
Bogdan

5 Replies

GS Gokul Sainarayanan Syncfusion Team April 16, 2018 08:59 AM UTC

Hi Bogdan,

We have prepared a MultiColumnComboBox sample as per your reported query in which we have set different DataSource for the 2nd MultiColumnComboBox based on the value selected in the 1st MultiColumnComboBox. Please download the sample from the following location.

Sample Link: http://www.syncfusion.com/downloads/support/forum/136991/ze/MultiColumnComboBox2-1060978075

Please check the attached sample and let us know whether it meets the reported requirement.

Regards,
Gokul S


CB CONSTANTIN BOGDAN April 16, 2018 09:10 AM UTC

My mistake! I want your excellent example working for one row in gridgroupingcontrol. My main goal is to use one combobox for one column to (pre)filter information for second combobox in the second column. The problem is how to set different datasource for second column/combobox (or what is the best approach in this case?).

Thanks


SN Sindhu Nagarajan Syncfusion Team April 17, 2018 10:00 AM UTC

Hi Bogdan, 


Thanks for the update. 

 The GridGroupingControl does not have direct support to change a column’s data source based on another column. This can be achieved by some workaround using the QueryCellStyleInfo event. In that event, the data source for a column can be set based on value of another ComboBox of the record and the cell value of another ComboBox column can be retrieved by using GetValue() method of Record. . We have created a simple sample as per your requirement. In the provided sample, the value of “SampleData” column can be modified based on the value the “CategoryID” column. Please refer to the below code and sample,    
    
Code example       
//Event Subscription           
 gridGroupingControl1.QueryCellStyleInfo += GridGroupingControl1_QueryCellStyleInfo; 
 
//Event customization 
private void GridGroupingControl1_QueryCellStyleInfo(object sender, GridTableCellStyleInfoEventArgs e) 
{ 
     var style = e.Style as GridTableCellStyleInfo; 
     if (style.TableCellIdentity == null || style.TableCellIdentity.Column == null) 
         return; 
     if (style.TableCellIdentity.Column.Name == "SampleData") 
     { 
         Element el = style.TableCellIdentity.DisplayElement; 
         if (el != null && el.Kind == DisplayElementKind.Record) 
         { 
             Record record = el.GetRecord(); 
             //Get the first column cell value 
             String value = record.GetValue("CategoryID").ToString(); 
             //Get the collection based on the first column value 
             List<CasCading> source = comboSource[value]; 
             //Assign the collection for second column. 
             e.Style.DataSource = source; 
             e.Style.DisplayMember = "SData"; 
 
         } 
     } 
}       
    


Please let us know if you have any other queries. 

Regards, 
Sindhu   
    



CB CONSTANTIN BOGDAN April 17, 2018 02:16 PM UTC

Thanks, excellent!


SN Sindhu Nagarajan Syncfusion Team April 18, 2018 04:24 AM UTC

Hi Bogdan, 

Thanks for the update. 

 Please let us know if you have any other queries. 

Regards, 
Sindhu  


Loader.
Up arrow icon