This is a migrated thread and some comments may be shown as answers.

Custom Column Order Per User

2 Answers 87 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Matthew
Top achievements
Rank 1
Matthew asked on 19 May 2016, 02:46 PM

Hello, 

I am trying to capture the order of columns headers after a user changes (re-orders) a column in the Grid. But so far I only seem to capture the original order.

I plan to store the order in the database, and when the grid is loaded re-order the columns for each user.

 

Here's a code snip that gets called after a user changes a column: (always gets original order) 

string sVal = "";
GridColumnCollection cols = grid.MasterTableView.Columns;
GridColumn c;
string[] sOrder = new string[grid.Items[0].Cells.Count];
 for (int i = 0; i < grid.Items[0].Cells.Count; i++)
            {
                sVal = grid.Items[0].Cells[i].ID.ToString();
                c = cols.FindByUniqueNameSafe(sVal);
                sOrder[i] = sVal + ":" + i.ToString();
            }

How do I get the actual order of columns after they are changed by the user? 

2 Answers, 1 is accepted

Sort by
0
Matthew
Top achievements
Rank 1
answered on 19 May 2016, 07:23 PM
Is it possible to change the grid's display order by JavaScript? 
0
Konstantin Dikov
Telerik team
answered on 24 May 2016, 08:01 AM
Hi Matthew,

For retrieving the order index of a column on server-side you could use the OrderIndex property of the columns:
As for the reordering on client-side, please refer to the following help article:
Hope this helps.


Regards,
Konstantin Dikov
Telerik
Do you need help with upgrading your ASP.NET AJAX, WPF or WinForms projects? Check the Telerik API Analyzer and share your thoughts.
Tags
Grid
Asked by
Matthew
Top achievements
Rank 1
Answers by
Matthew
Top achievements
Rank 1
Konstantin Dikov
Telerik team
Share this question
or