Sorting by DisplayMember

Hello,

I need a little bit help.
I have a GGC bind to my database maintable. In the maintable are many columns with IDs and in the other db-tables are the displaymembers.
I use this to connect the both tables:

            gridGroupingControlVehicle.TableDescriptor.Columns["GlobalStatus"].Appearance.AnyRecordFieldCell.CellType = GridCellTypeName.GridListControl;
            gridGroupingControlVehicle.TableDescriptor.Columns["GlobalStatus"].Appearance.AnyRecordFieldCell.DataSource = _status;
            gridGroupingControlVehicle.TableDescriptor.Columns["GlobalStatus"].Appearance.AnyRecordFieldCell.DisplayMember = "Status";
            gridGroupingControlVehicle.TableDescriptor.Columns["GlobalStatus"].Appearance.AnyRecordFieldCell.ValueMember = "VehicleStatusId";
            gridGroupingControlVehicle.TableDescriptor.Columns["GlobalStatus"].Appearance.AnyRecordFieldCell.ShowButtons = GridShowButtons.Hide;

But when I click on the header of a column it sorts by the ID and not by the displaymember. Is there a way to expand my code to sort by displaymember?
I think I have 10 IDs in my maintable with 10 different (sub-)tables in my database.

Thanks for your support
Thomas

1 Reply

AR Arulpriya Ramalingam Syncfusion Team December 8, 2017 12:21 PM UTC

Hi Thomas,  
  
Thanks for contacting Syncfusion support.  
  
By default, the records are sorted based on the ValueMember of the column. The SortByDisplayMember property can be enabled to sort the records based on display member of the column. Already we have provided a dashboard sample and documented the details in our user guide. Please refer to the below code, UG and dashboard sample,  
  
Code example  
  
//To sort the column by DisplayMember  
gridGroupingControlVehicle.TableDescriptor.Columns["GlobalStatus"].SortByDisplayMember = true 
  
  
Dashboard sample link: <Install_Location>\Syncfusion\EssentialStudio\<Product_Version>\Windows\Grid.Grouping.Windows\Samples\Sorting\Sort By Display Member Demo\cs   
  
Regards,  
Arulpriya  


Loader.
Up arrow icon