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. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

GGC Excel-Filter sorting by Displaymember

Thread ID:

Created:

Updated:

Platform:

Replies:

142006 Jan 14,2019 03:58 PM UTC Sep 6,2019 07:04 AM UTC WinForms 5
loading
Tags: GridGroupingControl
Thomas
Asked On January 14, 2019 03:58 PM UTC

Hello,

is it possible to sort in a GGC Excel-Filter (see attachment) the entries by DisplayMember?

I tried:
            foreach (var column in gridGroupingControlVehicle.TableDescriptor.Columns)
            {
                column.SortByDisplayMember = true;
                column.AllowFilter = true;
            }

Thanks for your support
BR Thomas

Attachment: GGC_Filter_Sorting_By_DisplayMember_18d3507c.zip

Arulraj A [Syncfusion]
Replied On January 17, 2019 06:11 AM UTC

Hi Thomas, 

Thanks for using Syncfusion product. 

To sort the values in GridExcelFilter listview based on the DisplayMember, you could use the FilterRowOptions.FilterMode property. Please refer the following code example. 

C# 
//ComboBox column 
this.gridGroupingControl1.TableDescriptor.Columns["Country"].FilterRowOptions.FilterMode = FilterMode.DisplayText; 
//Or 
  foreach (var column in gridGroupingControlVehicle.TableDescriptor.Columns) 
{ 
    column.FilterRowOptions.FilterMode = FilterMode.DisplayText; 
        column.AllowFilter = true; 
} 
 

Regards,  
Arulraj A 


Thomas
Replied On January 27, 2019 08:10 AM UTC

Hello,

thanks for your replay.
I tried your solution in my code, but it did not work. Then I tried your solution in the attachment and it did not work either (see the screenshot in the attachment).

BR Thomas

Attachment: 20190127_09_02_57GridGroupingControl_7a03b71b.zip

Arulraj A [Syncfusion]
Replied On January 28, 2019 12:25 PM UTC

Hi Thomas, 

Thanks for your update. 

By default, ComboBox column loads the items based on the binding collection so, GridGroupingControl does not have the direct support to sort the dropdown items. But, you could achieve your requirement by using CurrentCellShowingDropDown event. Please refer the following code example. 

C# 
this.gridGroupingControl1.TableControl.CurrentCellShowingDropDown += TableControl_CurrentCellShowingDropDown; 
private void TableControl_CurrentCellShowingDropDown(object sender, GridCurrentCellShowingDropDownEventArgs e) 
{ 
    GridCurrentCell currentCell = this.gridGroupingControl1.TableControl.CurrentCell; 
    GridTableCellStyleInfo style = this.gridGroupingControl1.TableControl.GetTableViewStyleInfo(currentCell.RowIndex, currentCell.ColIndex); 
    GridComboBoxCellRenderer renderer = this.gridGroupingControl1.TableControl.CurrentCell.Renderer as GridComboBoxCellRenderer; 
    if (renderer != null) 
    { 
        var list = renderer.ListBoxPart.Items.Cast<DataRowView>().OrderBy(x => x.Row[1]).ToList(); 
        renderer.ListBoxPart.DataSource = null; 
        if (style.HasDisplayMember) 
        { 
            renderer.ListBoxPart.DisplayMember = style.DisplayMember; 
            renderer.ListBoxPart.ValueMember = style.ValueMember; 
        } 
        renderer.ListBoxPart.DataSource = list; 
    } 
} 
 

Arulraj A 


Thomas
Replied On September 5, 2019 12:46 PM UTC

Hello,

thanks for your solution, but when I try, the sort does not work (see the attachment).

I need: China, England, India, Pune, UK and USA.

Thanks for your support
Thomas 

Attachment: 20190905_14_40_49GridGroupingControl_696f4a15.zip

Arulpriya Ramalingam [Syncfusion]
Replied On September 6, 2019 07:04 AM UTC

Hi Thomas,   
   
Thanks for the update.   
   
The GridExcelFilter for the GridGroupingCotnrol does not have the default or customization support for the FilterPopUp. Moreover, the CheckedBoxList items will be added by retrieving each record value for the column and add the unique value to the list and the Checked box items could not be retrieved at sample level to sort it manually. Also, the Sort A to Z or Sort Z to A will sort the grid records but not the filter popup items. So, we regret to let you know that the GridExcelFilter for the GridGroupingControl does not have any built-in or extensible support to customize the filter drop down of ExcelFilter.   
   
Please revert to us, if you have any other queries.   
   
Regards,   
Arulpriya   


CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

;