Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 126327
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T05:18:01+00:00 2026-05-11T05:18:01+00:00

The TreeView is a nice way to present a hierarchy to users, but imagine

  • 0

The TreeView is a nice way to present a hierarchy to users, but imagine the following scenario with the hierarchy depicted below:

Building 1   -Tenant 1    - Payment 1    - Payment 2 Building 2  -Tenant 1    - Payment 1  -Tenant 2    - Payment 1    - Payment 2 

where you need to do an insert to a database when the user clicks on the Payment node. Essentially the variables required for the insert are Building_Id, Tenant_Id, Payment_Id. One way to assemble these is to walk to the parent of each node:

Building_Id = Payment.ParentNode.ParentNode.Id 

Is it better to store all of the values of the id’s on the Payment Node in the following format, then parse the values for Building_Id, Tenant_Id, Payment_Id? For example:

Payment.Value = '1|2|1' 
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. 2026-05-11T05:18:01+00:00Added an answer on May 11, 2026 at 5:18 am

    I find the best way to handle additional data is to subclass TreeNode. I create a BaseNode class that contains the shared data I want to maintain, and inherit further from that for any specific node types.

    The value of subclassing is that you can maintain strong data types and complex data types just like any other class… which avoids hacking arrays into a string with pipe separators and the like.

    Once you have your nodes in place it allows the same tree walk you propose, except now you are pulling the values from (say) BaseNode.MyData (which all your subtypes will inherit).

    One thing to watch for if you do this though: you need to understand how authoritative you want these nodes to be. In my case, when the user navigates the tree we check with a database cache to ensure we don’t need to repopulate the data.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm building a website where one of the main features is a nice treeview
So in my project i would like have a nice treeview that has images.
My Treeview looks like this: its haml submission_database = @users.each do |user| %ul %li
Does anyone know of a good TreeView for the web that is nice looking,
Is there a nice way (except retemplating the whole TreeViewItem.Template ) to disable selection
Is there some simple way or how to integrate sqlite database into gtk.TreeModel (TreeView)?
I'm using PyGTK TreeView (as list) for my data. Is there any way to
The TreeView control has the checkboxes property, but it puts a checkbox on every
I have used jqGrid Treeview Adjacency model to display the hierarchy. Treeview works perfectly
I have a TreeView that binds to XML data and one DataGrid that binds

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.