NTreeList, how to persist/restore column order? And what is correct way to access columns if you...


NTreeList, how to persist/restore column order? And what is correct...
Author
Message
lars knox
lars knox
Junior Member (22 reputation)Junior Member (22 reputation)Junior Member (22 reputation)Junior Member (22 reputation)Junior Member (22 reputation)Junior Member (22 reputation)Junior Member (22 reputation)Junior Member (22 reputation)Junior Member (22 reputation)
Group: Forum Members
Posts: 22, Visits: 1

We have an NTreeList in a WinForms application. We have the AllowColumnReorder property set to true and are allowing users to change the order of the columns. I have two questions regarding this.

(1) After a column reorder, I can see that the NTreeList.Columns objects are rearranged (examined through the IDE's watch list), and they have new Index values. However, I am programatically reading and setting values using the old index values. Why does this continue to work when I have rearranged the columns?

(2) I need to persist the column order and load it back into the NTreeList the next time the application starts. The SaveToXml()/LoadFromXml() methods only save/restore the node data & original column configuration, not the new column orders. How would I get this to work? If I could successfully persist and restore the column orders, would I have to programmatically reference the columns by their column names instead of by their original index values?

I'm just a little confused because I can't find any data in the NTreeList object that describes how the columns are reordered (except the Index values), and when I do reorder them it doesn't make sense why current logic that accesses columns by index values continues to function. Any code, direction or documentation would be greatly appreciated. Thank you!

Lars

 

 


Nevron Support
Nevron Support
Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)
Group: Administrators
Posts: 3.1K, Visits: 4.2K

Hello Lars,

 

I am not sure I understand your first question correctly.

Let’s say that you have 3 columns in your NTreeList – column0, column1 and column2. They initially reside in Columns collection in the same order, therefore their Index property will be 0,1,2.

After the user change their initial order their new order in the columns collection is following:  Columns[0] is column1 with Index 0, Columns[1] is column0 with Index 1 and Column[2] is column2 with Index 2 (first two columns are swapped).

So you are saying that if you want to change for example the Text value of the column’s Header on Columns[0]  it will change the text of column0. Is that correct?

I’ve made such test and the text of column1 was change, because column1 has Index=0.

Could you please elaborate?

 

Regarding the serialization of the column order – we use XML serialization which does not serialize read only properties, and Index property (which determines the order of the columns) is read only and it cannot by serialized.



Best Regards,
Nevron Support Team


GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...




Similar Topics

Reading This Topic

Login

Explore
Messages
Mentions
Search