We have a grid which was created "on the fly" and are having issues with sorting.While sorting works if the header is clicked, we need it to sort by that column upon load. Methods used for other grids (init_layout event) don't seem to work without the user clicking the header first.
Is there any way to get the absolute screen coordinates from the UIElement? Any methods for emulating a mouse click on the header for the desire column.
Hi,
Hady is correct, although I would use the InitializeLayout event and use e.Layout instead of this.ultraGrid1.Layout.
If sorting programmatically is not working for you, then my guess is that your grid doesn't have data, or doesn't have all of the data when you are setting the SortIndicator property. Sorting the grid happens when you set the property. Any rows that are added to the grid after that are not sorted automatically.
So you probably need to change where you are setting the SortIndicator, or else call the Band.SortedColumns.RefreshSort method to refresh the sorting after all of the rows have been added.
if you want to add a sorted column you can use the following after setting the datasource
ultraGrid1.DisplayLayout.Bands[0].SortedColumns.Add(ultraGrid1.DisplayLayout.Bands[0].Columns[0], false);