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. Image for the cookie policy date
close icon

Problem grouping a CombobBox column

Hi

I'm using the GridGroupingControl version 4.4.0.51.

The application I'm workin on uses several combobox columns which I want to group. The
comboboxes have their own datasource, so that in these columns the grid datasource only contains an ID and not an actual value. The text is displayed by the combobox.
This works well and grouping also works, but with one big problem: the grid shows the ID in the grouped row and not the value of the cell. Grouping becomes worthless because of this, because the ID is completly useless to the user.

I'm using the standard CaptionText: "{CategoryCaption} : {Category} - {RecordCount} Items"

Hopefully that was understandable and anybody can help me.


4 Replies

NA Nisha Arockiya A Syncfusion Team January 12, 2009 01:02 PM UTC


Hi Fabian,

Thanks for your interest in Syncfusion Products.

I am afraid that I couldnot able to reproduce the issue here. Can you modify the attached sample to reproduce the issue so that we will work on it here for you? In the meantime, you can handle the TableControlCurrentCellCloseDropDown event to modify the value in the currentcell.

EditGGC.zip

Please let me know if this helps.

Regards,
Nisha.



FA Fabian January 12, 2009 02:18 PM UTC

OK, I modified the example. You simply have to group "Col2". The grouping row (the one with the +) will only show the numbers and not "value_1" etc.

I want to see the displaymember there and not the valuemember. I hope it's clear now what I'm talking about.



EditGGC_updated_d72ae245.zip


NA Nisha Arockiya A Syncfusion Team January 13, 2009 10:41 AM UTC

Hi Fabian,

Thanks for the update.

The DisplayMember Value can be set in the Caption by handling the QueryCellStyleInfo event handler. In the QueryCellStyleInfo event handler check for the particular (ComboBox column) group name (the name of the column by which the group is categorized) and get the display member for the Category/value member from the table and set it in the e.Style.Text.


void sortGrouping_QueryCellStyleInfo(object sender, GridTableCellStyleInfoEventArgs e)
{
GridGroupingControl grid = sender as GridGroupingControl;
if (e.TableCellIdentity.TableCellType == GridTableCellType.GroupCaptionCell)
{
Group group = e.TableCellIdentity.DisplayElement.ParentGroup;
if (group.Category != null && group.Name == "ID")//Check for the ComboBox(lookup) column
{

DataRow[] dr = dt.Select("Lookup_id = " + group.Category.ToString());
if (dr.GetLength(0) > 0)
{
string dispCat = dr[0]["Lookup_member"].ToString();
e.Style.Text = grid.TableDescriptor.Columns[group.Name].HeaderText + ": " + dispCat + " - " + group.GetFilteredRecordCount().ToString() + " Items.";
e.Handled = true;
}

}
}
}


Here is a sample.

Please let me know if this serve your needs.

Regards,
Nisha.



FA Fabian January 13, 2009 12:41 PM UTC

Yes, that seems to work.

Thank you very much!


Loader.
Live Chat Icon For mobile
Up arrow icon