Current filter:
                                You should refresh the page.
                                  • Hi, I have an XtraGrid that uses a custom column sort so that numeric values are sorted in a more natural order, e.g. 1,2,3,10 instead of 1,10,2,3.

                                    The problem I'm having is that the custom sort is not being applied to the list of values in the column filter (see attached screenshot) . Is there any way to make the custom column sort apply to this list as well?

                                    Thanks.

                                1 Solution

                                Creation Date Importance Sort by

                                Hi,

                                Filter values do not take the current grid sorting order into account. You can sort them manually by handling the GridView.FilterPopupExcelData event.

                                [C#]
                                private void GridView1_FilterPopupExcelData(object sender, DevExpress.XtraGrid.Views.Grid.FilterPopupExcelDataEventArgs e) { e.DataItems.Sort((x, y) => { string text1 = x.Text.Replace("FW", ""); string text2 = y.Text.Replace("FW", ""); return Comparer<int>.Default.Compare(Convert.ToInt32(text1), Convert.ToInt32(text2)); }); }
                                [VB.NET]
                                Private Sub GridView1_FilterPopupExcelData(ByVal sender As Object, ByVal e As DevExpress.XtraGrid.Views.Grid.FilterPopupExcelDataEventArgs) e.DataItems.Sort(Function(x, y) Dim text1 As String = x.Text.Replace("FW", "") Dim text2 As String = y.Text.Replace("FW", "") Return Comparer(Of Integer).Default.Compare(Convert.ToInt32(text1), Convert.ToInt32(text2)) End Function) End Sub

                                Try this approach and let me know your results.

                                • Adam.Nicol 10.11.2019

                                  That worked, thanks.