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. Image for the cookie policy date

GridDataControl Sorting

Hi,

How can i cancel the sorting in the GridDataControl on the Column header ? Can I override default sorting behavior?

Thanks in advance

Thomas M.

3 Replies

GK Ganesan K Syncfusion Team October 29, 2009 01:58 PM UTC

Hi Thomas,

You can set the "AllowSort" property to false for cancelling the sort operation in the GridDataControl on the Column.

If you want to disable the sorting for all the visible columns then you can use the AllowSort property in "GridDataControl"

x:Name="dataGrid"
AutoPopulateColumns="True"
AutoPopulateRelations="False"
AllowSort="False" />

If you want to disable the sorting for a particular visible column then you can use AllowSort property in the "GridDataVisibleColumn"




Please let us know if you need any more details.

Thanks
Ganesan


ER Ezequiel Reyno December 16, 2009 06:32 PM UTC

Hi,

I need to group by a fieldDisplayName but i need the groups to appear sorted by another field, fieldID.
FieldID will not be displayed in the columns.

How can i get this group/sorting behavior?

Thanks in advance,
Ezequiel.


MS Mohamed Suhaib Fahad A. Syncfusion Team December 17, 2009 05:45 AM UTC

Hi Ezequiel,

Yes, this is possible. The default behavior of the grid when you drag and drop is that it will add a Sort Column automatically. So for your scenario, You can do it in some external event,

var view = this.dataGrid.Model.View;
using (view.DeferRefresh())
{
this.dataGrid.GroupedColumns.Add(new GridDataGroupColumn() { ColumnName = "ShipCountry" });
this.dataGrid.SortColumns.Add(new GridDataSortColumn() { ColumnName = "ShipCity" });
}

Add the appropriate Group & Sort column in the collections. I also have a sample uploaded in the below location,

http://www.syncfusion.com/uploads/redirect.aspx?&team=support&file=sample910367894.zip

Thanks,
Fahad

Loader.
Live Chat Icon For mobile
Up arrow icon