Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » scout » Hierarchical Table (How to use the Hierarchical Table?)
Hierarchical Table [message #1797023] Wed, 24 October 2018 08:49 Go to next message
The Maddes is currently offline The MaddesFriend
Messages: 44
Registered: October 2018
Member
Hello community,

first of all, I'm pretty new to the java, eclipse and therefore scout world.
At the moment I'm working on a scout project and think that its a pretty awesome framework. I stumbled upon the release notes that Hierarchical Table is now supported with a nice screenshot but no real documentation (as far as i found anything)

So i managed to import my pageData from the database and display it in a regular table with columns etc.

Now as i read about the hierachical table it made a lot of sense to me and would improve the readability etc for the user.

I have
a Project which has an int ID
and it MAY have a parentProjectId.

So i thought it would be easy to tell the table that the parentKey is the ID itself and then go for the parentProjectId to map it to the given ProjectIds.

But unfortunately i dont get it to run. So if anyone has a tip or a little example for me how to handle this, i would really appreciate your effort!

And sorry if i miss anything in my explanation, first timer on this board :)
Re: Hierarchical Table [message #1797035 is a reply to message #1797023] Wed, 24 October 2018 10:30 Go to previous messageGo to next message
Patrick Bänziger is currently offline Patrick BänzigerFriend
Messages: 90
Registered: September 2011
Member
Hi there

I'm glad you like Scout!

What you need for the hierarchical table to work are three things:


  1. A Key that can be compared with the `equals` method
  2. A column marked with getConfiguredPrimaryKey =true containing the key of the row.
  3. Another column marked with getConfiguredParentKey = true. This indicates the key of the parent of the current row.


The first point is usually only relevant if you have an composite object as a key which does not provide a way to determine if it is equal to another instance. Basic Java Primitives (String, Long, ...) should work out-of-the-box.

You can find a simple example in the Widgets application source code

Regards,
Patrick

[Updated on: Wed, 24 October 2018 10:31]

Report message to a moderator

Re: Hierarchical Table [message #1797045 is a reply to message #1797035] Wed, 24 October 2018 12:02 Go to previous messageGo to next message
The Maddes is currently offline The MaddesFriend
Messages: 44
Registered: October 2018
Member
Hey Patrick,

thanks a lot for your answer, it helped me to make it work out!

I think the problem in my case was, that the Column i declared as getConfiguredPrimaryKey was a SmartColumn with a lookupcall behind it.
Therefore i always got an error ""Could not find the parent row of ...." from AbstractTable.
I dont know if it was my fault or if it is supposed to not work with SmartColumns, but as i made the column an IntegerColumn it worked out well.

Thanks again!
Re: Hierarchical Table [message #1797049 is a reply to message #1797045] Wed, 24 October 2018 12:25 Go to previous messageGo to next message
Patrick Bänziger is currently offline Patrick BänzigerFriend
Messages: 90
Registered: September 2011
Member
Great, I'm happy that it works!

Basically it should also work with SmartColumns - the code which searches for the parent row is pretty straightforward.
What was the value type of your SmartColumn - meaning the generic type (SmartColumn<String>)? If it was a class you wrote yourself - does it have an equals method? (Point 1 of my first reply)
Re: Hierarchical Table [message #1797093 is a reply to message #1797049] Thu, 25 October 2018 07:23 Go to previous messageGo to next message
The Maddes is currently offline The MaddesFriend
Messages: 44
Registered: October 2018
Member
Hey Patrick,

my SmartColumn was of type <Long> and thats where the problem was.
My getConfiguredPrimaryKey() Column was of type Integer.
So theres a problem somewhere of casting or something else in the code. I couldnt figure it out on the fly. As i changed it to Integer it works out well.
Re: Hierarchical Table [message #1797171 is a reply to message #1797093] Fri, 26 October 2018 15:41 Go to previous message
Patrick Bänziger is currently offline Patrick BänzigerFriend
Messages: 90
Registered: September 2011
Member
Hi The Maddes

Ok, that I guess was the problem: A Long and Integer are not equal, even if the represent the same number.
Typically, you'd have the same class as generic type for parent and primary key columns (if the hierarchy of rows represents objects of the same "kind").
Example: You have a hierarchical table of people in an organization - the primary key would be "Long" (the employee id) and the parent key as well "Long" (for example: the employee id of the manager of the person). This works out of the box.

If that is not the case since the hierarchy is of different objects at different levels (with different keys), custom handling is necessary.
Previous Topic:User credential and verification
Next Topic:How to Show / Hide Outlines depending on User Session
Goto Forum:
  


Current Time: Tue Oct 15 03:40:07 GMT 2019

Powered by FUDForum. Page generated in 0.02271 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top