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.
Unfortunately, activation email could not send to your email. Please try again.

change column order

Thread ID:

Created:

Updated:

Platform:

Replies:

118539 Mar 17,2015 06:57 PM Feb 3,2016 08:48 AM WPF 5
loading
Tags: GridDataControl
Henry Harris
Asked On March 17, 2015 06:57 PM

Is there a way we could have column order determined at runtime?  For instance, we define a grid with three columns, col1, col2 and col3 in that order.  But our user always changes the order to col2,col1,col3.  Is there a way we can have the column order by user specific?

Saravanan M [Syncfusion]
Replied On March 18, 2015 07:40 AM

Hi Henry,

Thank you for contacting Syncfusion support,

We have analyzed your query. GridDataControl provide method Add, Remove and Insert the column at runtime. So that you can change the columns order as you want.VisibleColumn.Add() method add the columns at last position and Insert method used to insert the column at specific location. Similarly Remove and RemoveAt method works accordingly.

In attached sample we have stored the column(Col1) and we have cleared it. We have insert the column(Col1) at First position , like this you can change the column order at runtime.

Code snippet[C#]:

private void Button_Click(object sender, RoutedEventArgs e)

{

var column = this.syncgrid.VisibleColumns[1];

this.syncgrid.VisibleColumns.RemoveAt(1);

this.syncgrid.VisibleColumns.Insert(0, column);

}

We have prepared the sample based on this and you can download it from below location,

Sample Location: GridDataControl_Sample.zip

We have a SfDataGrid control like GridDataControl. But compare to GridDataControl, SfDataGrid having a better performance and flexibility. SfDataGrid assists you to create entirely customizable and highly interactive features used to display and manipulate the huge amount of data. So, we suggest you to use SfDataGrid instead of GridDataControl.

You can also achieve the same requirement in SfDataGrid too. We have prepared a sample based on this and you can download it from below location,

Sample Location: SfDataGrid_Sample.zip

You can also refer the below documentation link to know more about SfDatagrid,

Documentation Link: http://help.syncfusion.com/ug/wpf/documents/overview6.htm

You can also refer the below comparison document between SfDataGrid and GridDataControl

Comparison Document: GridDataControl_SfDataGrid_Comparison.zip

Please let us know if you have any other queries,

Regards,

Saravanan.M


Henry Harris
Replied On March 23, 2015 04:49 PM

Thanks that is exactly what I needed

Saranya CJ [Syncfusion]
Replied On March 24, 2015 02:32 AM

Hi Henry,

Thank you for your reply. Please let us know if you require any other assistance on our controls.

Regards,

Saranya

sabrina c.
Replied On February 2, 2016 10:22 AM

Just a short comment, having this snippet of code in the Column section of the SFDataGrid documentation, or the KB would be nice.
It is in fact very useful if you want to build a grid and save the position of the columns on exit as a user setting
and show him the columns as he left them in his last session without much fuss :o)
thanks for writing it
Sabrina

Sowndaiyan Paulpandi [Syncfusion]
Replied On February 3, 2016 08:48 AM

Hi Sabrina,

Thanks for thr suggestions.

Currently we are working on SfDataGrid UG documentation and we will include this details in our documentation. In SfDataGrid you can retain the SfDataGrid old status using the Serialization and Deserialization support. You can refer the below UG link for know more about the this,

Link : http://help.syncfusion.com/wpf/sfdatagrid/serialization-and-deserialization#overview


Regards,


Sowndaiyan

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.

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.

;