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

TableDescriptor columns order

Hi, How the columns order is assigned in TableDescriptor?. The Datasource of my Grouping control is a struct. Just after datasource was set, the TableDescriptor has different columns order (which defines display order)then struct had. So how could I control columns order?

3 Replies

Administrator July 17, 2006 07:02 AM UTC

Hi Irina, Refer to the KnowledgeBase(KB) article link below, that helps in doing this. http://www.syncfusion.com/support/kb/grid/Default.aspx?ToDo=view&questId=159 Thanks for using Syncfusion Products. Regards, Rajagopal

IJ Irina Jouk July 17, 2006 05:09 PM UTC

Hi Rajagopal, In TableDescriptor by default I have col#3 ''Memo'' and col#6 ''Hours'' When I try to change the order of both columns to display first ''Hours'' and then ''Memo'' by using tableDescriptor.Columns[3].Name="Hours" I get an error {"Item has already been added. Key in dictionary: \"Hours\" Key being added: \"Hours\"" } When I use tableDescriptor.VisibleColumns[3].Name="Hours", it works, but when later in TableModel_SaveCellFormattedText event I use grpctrlActivityList.TableDescriptor.NameToField("Hours") it returns original col index (i.e. #6). Looks like VisibleColumns order is changed but not Columns order. What can I do with that? Thanks

Administrator July 18, 2006 12:19 AM UTC

If you want to move columns in the Columns collection, then try using TableDescriptor.Columns.Move. //move "Col2" to position 2 in the Columns collection int col4 = gridGroupingControl1.TableDescriptor.Columns.IndexOf("Col4"); gridGroupingControl1.TableDescriptor.Columns.Move(col4, 2); Or, you can use gridGroupingControl1.TableDescriptor.Columns.Remove to remove an existing and then use gridGroupingControl1.TableDescriptor.Columns.Insert to insert it somewhere else in the collection.
Loader.
Live Chat Icon For mobile
Up arrow icon