|
| Re: Tree Box [message #1014929 is a reply to message #1014838] |
Tue, 26 February 2013 15:55   |
Jeremie Bresson Messages: 266 Registered: October 2011 |
Senior Member |
|
|
I have assumed that you know your parameters on the client.
Just add them in a LookupCall (execPrepareLookupCall):
http://wiki.eclipse.org/Scout/Concepts/LookupCall#Members
In my example the parameters are constants set in the client. In the reality I assume they come dynamically from elsewhere.
And use them in the corresponding SqlLookupService:
See the last example for getConfiguredSqlSelect, it used the LanguageLookupCall defined in the first page:
http://wiki.eclipse.org/Scout/Concepts/Sql_Lookup_Service#Properties
---
I can provide more information on the where-clause I added if needed:
WHERE t.from_date < :validityTO AND t.to_date > :validityFROM
---
If the date depends on the current date, I think you can write your select to use trunc(sysdate).
---
NB: Instead of writing the same twice, I haved tried a wiki-first approach. Let me know if this is not enought and I need to fill the gap with more explanations.
[Updated on: Tue, 26 February 2013 16:10] Report message to a moderator
|
|
|
|
| Re: Tree Box [message #1015059 is a reply to message #1015017] |
Wed, 27 February 2013 05:30   |
 |
marco giudici Messages: 38 Registered: February 2013 |
Member |
|
|
Ok, now I can load the root element for each node with a first lookup call, with the method loadRootNode.
Now for each root element, I have to load the child elements. I try to use the same lookup call but it didn't work as hoped because it duplicated the root elements for the number of child elements.
With this sample query I populate the root elements in tree box:
With I change this query in the following way:
Select Root, Child From MyTable
in the tree box, the root elements are duplicated.
For this reason, I would use a second lookup call to retrieve all child elements for each root elements.
Select Child From MyTable Where Root='****'
Is this a correct idea or not? How could I proceed?
[Updated on: Wed, 27 February 2013 05:32] Report message to a moderator
|
|
|
| Re: Tree Box [message #1015204 is a reply to message #1015059] |
Wed, 27 February 2013 12:55   |
Jeremie Bresson Messages: 266 Registered: October 2011 |
Senior Member |
|
|
Hi,
Is your data coming from the same table?
Something like:
+-----+-------+-----------+
| id | name | parent_id |
+-----+-------+-----------+
| 125 | Lorem | - |
| 548 | Ipsum | - |
| 587 | Dolor | 125 |
| 874 | Artis | 125 |
+-----+-------+-----------+
For this tree:
+-+ Lorem
| |
| +----- Dolor
| |
| \----- Artis
|
\-- Ipsum
You can use a select like this:
SELECT id, text, NULL, NULL, NULL, NULL, NULL, 1, parent_id, 1
FROM my_table
|
|
|
|
| Re: Tree Box [message #1015374 is a reply to message #1015331] |
Thu, 28 February 2013 07:04   |
Jeremie Bresson Messages: 266 Registered: October 2011 |
Senior Member |
|
|
From the wiki page:
http://wiki.eclipse.org/Scout/Concepts/Sql_Lookup_Service#Properties :
Quote:(..) The AbstractSqlLookupService actually allows you to return additional meta-data that controls how the returned data is presented to the users. You can for example return icon IDs, color codes, tooltip texts or font descriptions. The complete list and order of all columns supported by the AbstractSqlLookupService is as follows:
Object key
String text
String iconId
String tooltip
String background color
String foreground color
String font
Boolean enabled (0,1)
Object parentKey used in hierarchical structures to point to the parents primary key
Boolean active (0,1)
The list is also provided by the Javadoc of AbstractSqlLookupService.
A check box in a tree-field, is considered as the value of this field in your form. In other words: the LookupCall/Service is not specific and can be (re)used everywhere (SmartField, SmartColumn, TreeBox, ...).
The usual way is to set the value on the field (dirrectly or using the formdata).
I will try to provide an example.
[Updated on: Thu, 28 February 2013 07:05] Report message to a moderator
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 3.50808 seconds