OK, I’ve been reading about the treeview bean but it looks like what I want to do is not possible
But before I’m going to look for another solution, I thought I’d post what I need/want to do here firts:
I have a form (data provider is not table I need for the tree).
I have (lets say) customers. Customers can have documents. (Cus to cus_doc and cus_doc to doc). In the tree I want to display a node called docs showing the numer of docs found for this customer usesing customer_id. Clicking on the + will show the docs.
Customers also have communication records. (Cus to comm and comm to commtype). I’d like to show a new node in the same treeview with the communication. Showing them by type with the amount of records found.
Customers also have contacts, cus to contact. So I want to show a new node in the same tree showing the amount of records found. Display the names when hitting the + and one level deeper, the adres(ses) by type same as comm.
Example of how it should look like:
+ Docs (2)
o Document_1
o Document_2
+ Comm (3)
+ Email (2)
o test@email.com
o test2@email.com
+ GSM (2)
o 06-12345678
o 06-98765432
+ Fax (1)
o 1234-567890
+ Contacts (2)
+ Mike (1)
+ Home (1)
o streetname 2 1234AA city
+ Jan (2)
+ Home(1)
o streetname 6 1234AA city
+ Work(1)
o street 16 3422FF Newcity
The default TreeView bean is limited to showing data from tables, which - in the situation you describe - doesn’t seem very suitable.
The extended TreeView bean can show data based on a dataset and that’s exactly the flexibility you need.
So the only thing you really need is a correctly build dataset and show it.
You have to keep in mind: the root nodes do not exist in your database, based on the existence of related docs/comm/contacts you can choose to add/skip those.
MichelvGent:
The id and pid don’t need to be an int, am I correct?
That’s correct, this was a constrain in an earlier version.
We requested a change for this as we only use(d) UUID’s and this was implemented shortly after that.
The version you downloaded does already has this change, so you should be able to use just anything.