Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
20
Master-Detail using UltraTree and Ultragrid
posted

Hi,

I guess most of you will know how to handle a master-detail scenario using two ultragrids and a dataset with a relation. The relation makes it easy for the detail grid to find the details for the current master row.

Now, imagine the master is not a grid, it's a ultratree. This tree is huge (~100000 nodes, it's an chart of accounts, including expired accounts for history). The tree is unbound and is built levelwise top-down. Each of the account nodes may link to detail rows (= account properties, i.e. dimension values).

Existing detail rows should be displayed on node selection, and of course, should be editable as in the master-detail-grid-example.

Unlike the master-detail-grid-demo, the unbound tree can't take advantage of the relation, as it is not bound. My approach of looking up the details of the current node key works, but is slow, as it uses LINQ.Where-construction to find the 5 properties in ~800k property rows. And what is more, the linq result is readonly.

So, my questions are:

  • what's a quick way to lookup the detail rows of a tree node?
  • how can I edit the details?

If you wonder "who on earth wants to see thousands of tree nodes at once": this is an editor for account plans, and financial reporting has correlations between the accounts, e.g. "show this amount in the balance account X, and drilldown this amount in many painstaking details in the notes part (e.g. detailed in currency, country, customer groups etc), So, if you touch the plan on one node, it's likely you have to adjust some other nodes as well. So, a "partial" tree is of no use.

Kind regards

Helmut

  • 34830
    Offline posted

    Hello Helmut,

    I have been investigating into the behavior you are looking to achieve in this case, and outside of using a LINQ.Where to find your properties, I’m not entirely sure what a faster way would be to look up detail rows of your tree nodes in this case. Perhaps you could utilize the UltraTree.GetNodeByKey method, but this would require you to know exactly what the unique key of your underlying node is, and I’m not sure this is a value that is possible for you to know in all cases.

    Regarding editing the details, the actual collection returned by the LINQ.Where query result would be read-only, but I would expect that the elements inside should be editable in some way? I am also under the impression that you are currently querying the UltraTree.Nodes collection, and so the elements in this resulting collection should be UltraTreeNode elements? If this is the case, you can likely go through the UltraTreeNode.Cells collections of each of the UltraTreeNodes within the result of your .Where query, and change the UltraTreeNodeCell.Value property to change your details rows.

    I hope this helps. Please let me know if you have any other questions or concerns on this matter.