Hi @all,
thanks to your help in the past days, I got my first Ultratree to work. But now, trouble strikes: my users request some additional features. :)
My Ultratree is based on the "2-table-approach", so I have a datatable tblRoot and a datatable tblData (tblRoot 1:n tblData; tblData 1:n tblData, so it's reflexive). This works well.
As the two datatables have identical, but many columns (~30; this is a calculation result in a temporary table, readonly), users ask to have a "personal selection" of these columns. They want to configure a personal "set of columns" for display. This set should be applied whenever the form opens. As users are picky, they want to be able to check/uncheck the available columns for display and save this set in user-related appsettings.
My idea led to some code. In a form. I offer all the columns in a CheckedListBox.
My questions:
Do I have to manage each of the Columnsets, when (apart from parent/child-relation) all columns in the Columnsets are the same?
Is Columnsets(...).Columns(...).Visible the right property to flip, or which else?
How can I persist the selection? "myUltraTree.SaveComponentSettings" seems to save "too much", as it led e.g. to disappearing CanExpandIndictors.
The Nodes get a key in the event InitializeDataNode. My code there is:
e.Node.Key = e.Node.Cells("BD_ID").Value
This ID field might be deselected, as many users don't deal with IDs. When this field is deselected for display, the cell is not available and the code crashes. How can I still set the key?
Thanks for any hint
Martin
Hello,
Yes, you are correct. To retain the hidden columns, you may iterate trough the column sets, and set the Visible property. You can also use SaveComponentSettings method. The second approach should be easier. If you meet any issues with it please send me a sample reproducing your issue, and I will be glad to look into it.
To set the node’s key, even when the necessary column is hidden, you may use its ListObject like this:
e.node.Key = ((DataRowView)node.ListObject).Row.ItemArray[Cell Index].ToString();
Please let me know if you have any additional questions.
I'm gonna give it a try.
Your code for Setting the key works, thank you.
my problems are solved. Thanks for your help. :D
Hi Martin,
I am glad to hear you have resolved your this issue.
Please let me know if you need any further assistance.