I am building a data source sorted the way I want, which is
list.OrderBy(x => x.EffectiveDate).ThenBy(x => x.InstallmentDate).ThenBy(x => x.SortOrder).ToList();
Then, in the InitializeLayout I have
e.Layout.Bands[0].Columns["EffectiveDate"].SortIndicator = SortIndicator.Ascending; e.Layout.Bands[0].Columns["PostDate"].SortIndicator = SortIndicator.Ascending; e.Layout.Bands[0].Columns["InstallmentDate"].SortIndicator = SortIndicator.Ascending;
As soon as this code runs, the grid is no longer sorted by my query, but by these 3 columns. How do I load the grid sorted the way I want, and still show the sort indicators for later use?
Thanks
Hi,
I don't understand exactly what you mean, You are sorting the grid by different fields than the data source. So, of course, the order of the rows will be different. How could it not be?
If you are using the latest version of the grid, then you might be able to use the "External" SortIndicator options which display the sort indicator but don't actually do any sorting. But when the user clicks the column header, the grid will not do any sorting - it will expect you to perform the sort yourself.
Can you explain what you mean by "External" SortIndicator options?
Hi Kevin,
Yes. The way it works is - when you set the HeaderClickAction to ExternalSortMulti, the grid displays the sorting UI (the sort indicators), but it does not actually perform any sorting. the actual sorting is left up to you. So you would handle the AfterSortChange event and sort the underlying data when the user makes a change.
So do I still set the SortIndicators?
Actually, I meant the HeaderClickAction property. There are choices for ExternalSortMulti and ExternalSortSingle.