Home » Eclipse Projects » scout » Tree SmartField Lookup
|
Re: Tree SmartField Lookup [message #1807869 is a reply to message #1807771] |
Tue, 11 June 2019 08:18   |
|
Hi Tim
There's an example for a hierarchical (local) lookup in our widgets application. See the "SmartField with Tree Content" here.
Check out the source code for DefaultTreeSmartField and the HierarchicalLookupCall.java.
When you use the lookup in a SmartField, the field must set the 'browseHierarchy' property, like this:
@Override
protected boolean getConfiguredBrowseHierarchy() {
return true;
}
When you use the AbstractSqlLookupService to create LookupRows, you must select/set the 'parentKey' field on each row. With that information the client builds the hierarchy. The list of rows returned by your LookupService should look like this:
- LookupRow[key=1, text=Root A, parentKey=null]
- LookupRow[key=2, text=A1 (child of A), parentKey=1]
- LookupRow[key=3, text=Root B, parentKey=null]
- LookupRow[key=4, text=B1 (child of B), parentKey=3]
- LookupRow[key=5, text=B1.1 (child of B1), parentKey=4]
- ...
Eclipse Scout Homepage | Documentation | GitHub
|
|
|
Re: Tree SmartField Lookup [message #1809400 is a reply to message #1807869] |
Mon, 15 July 2019 13:45   |
Tim Meuser Messages: 16 Registered: February 2019 |
Junior Member |
|
|
Hi,
thanks for your answer.
I used the tree box sql lookup to build my hierarchy:
@Override
protected String getConfiguredSqlSelect() {
return "" +
"SELECT " +
" C.COMPANY_NR, " + // key
" C.SHORT_NAME || ': ' || C.NAME, " + // text
" C.LOGO, " + // iconId
" C.TOOLTIP, " + // tooltip
" 'F0F0F0', " + // background
" '404040', " + // foreground
" '" + Font.SERIF + "', " + // font: not yet clear how this works
" 1, "+ // enabled
" null, "+ // parent
" 1 "+ // active
"FROM COMPANY C " +
"WHERE 1=1 " +
"AND (C.TYPE_UID = :master OR :master IS NULL) " +
" AND C.COMPANY_NR = :key " +
" AND ((UPPER(C.NAME) LIKE '%'|| UPPER(:text)||'%') OR (UPPER(C.SHORT_NAME) LIKE '%'||UPPER(:text)||'%')) " +
" ";
}
Now my problem is that the tree box is showing nodes with multiple parents correctly, but the smart field is only loading the node one time (images). Is there a way that the smart field looks like the tree box?
|
|
| | |
Goto Forum:
Current Time: Wed Dec 11 19:57:18 GMT 2019
Powered by FUDForum. Page generated in 0.01807 seconds
|