Table action problem with screens count 2

20 views
Skip to first unread message

Teemu Simolin

unread,
Feb 3, 2015, 8:40:13 AM2/3/15
to openlega...@googlegroups.com
Hi,

I've got a table with screens count 2 in a REST application. At runtime when I try to select a table action from the first row in the table it actually makes table action to the first row of the second screen. What might be wrong?

Best,

Teemu

Roi Mor

unread,
Feb 3, 2015, 8:53:34 AM2/3/15
to openlega...@googlegroups.com
Hi Teemu,

Collecting multiple screens requires to use target entity in the links, which adds the row key to the URL.
The target screen needs to know in @ScreenNavigation how to find the correct row key.
You should configure drilldownAction in @ScreenNavigation of the target entity. By default Openlegacy decides if to perform pageup or pagedown based on alphanumeric of the primary key, or sortIndex property of @ScreenColumn (if configured).

This the the algorithm:

Roi Mor

unread,
Feb 3, 2015, 9:19:56 AM2/3/15
to openlega...@googlegroups.com
Another programmatic option, is to implement custom navigation by defining a class which extends TerminalAction (e.g NavigateTo<DetailsScreen>), and define it in
@ScreenNavigation(terminalAction=<NavigateTo<DetailsScreen>.class ...)

In this action you can use keys var to get the provided keys/s, and navigate to the target screen using the session API.
A common use case is using search field on the list screen to avoid multiple pageup/down.

Teemu Simolin

unread,
Feb 4, 2015, 2:29:44 AM2/4/15
to openlega...@googlegroups.com
Thanks Roi,

When I generated view from an entity with a target entity in a table action there is still doActionNoTargetEntity() in the view.

-Teemu

Roi Mor

unread,
Feb 4, 2015, 5:04:16 AM2/4/15
to openlega...@googlegroups.com
Thanks Teemu.
We will add validation so that once screen count > 1, you must define target entity in the table actions.

Teemu Simolin

unread,
Feb 4, 2015, 6:00:45 AM2/4/15
to openlega...@googlegroups.com
I tried with a custom navigation class but I got an error message saying that the class must extend TerminalDrilldownAction.

Roi Mor

unread,
Feb 4, 2015, 6:43:54 AM2/4/15
to openlega...@googlegroups.com
You should remove drilldownValue attribute from @ScreenNavigation.
When writing custom navigation action, you implement the drilldown yourself in the custom class using session API.

Teemu Simolin

unread,
Feb 10, 2015, 8:03:17 AM2/10/15
to openlega...@googlegroups.com
Hi Roi,

I could not get this option to work with screens count > 1 problem. It selects a wrong record. Here's the navigation class according to your example you did sometimes before to another navigation problem:

public static class NavigateToTasojenTuotteet implements TerminalAction {

public void perform(TerminalSession session, Object entity, Object... keys) {
// don't continue if no keys passed in URL
if (keys.length == 0) {
return;
}

if (session.getEntity() instanceof TuotekuvastonHakemisto) {
TuotekuvastonHakemisto tuotekuvastonHakemisto = (TuotekuvastonHakemisto) session.getEntity();
// get and iterate through all rows
List<TuotekuvastonHakemistoRecord> records = tuotekuvastonHakemisto.getTuotekuvastonHakemistoRecords();
for (TuotekuvastonHakemistoRecord record : records) {
// if current row matches the request key, mark it with T
if (record.getAvain().equals(keys[0])) {
record.setValinta("T");
break;
}
}
// send the modified screen (with "T" mark)
session.doAction(TerminalActions.ENTER(), tuotekuvastonHakemisto);
}

}

public boolean isMacro() {
return true;
}

}

Should that be modified somehow? The problem is also I cannot debug that like I wrote in another question today.

-Teemu 


tiistai 3. helmikuuta 2015 16.19.56 UTC+2 Roi Mor kirjoitti:

Roi Mor

unread,
Feb 10, 2015, 1:22:36 PM2/10/15
to openlega...@googlegroups.com
Hi Teemu,
The code you sent selects a row in the current screen only, and not through the entire collected screens. There is a need to perform PAGE_UP or PAGE_DOWN to get to the right screen, base on the provided keys to the perform methods.

Custom navigation is good if you have a search field which know to jump to the right record key.
If not, I recommend to use @ScreenColumn.soetIndex which uses to explain to OpenLegacy the sorting of the table, so OL can decide if to PAGE_UP or PAGE_DOWN until finding the correct record.
We can do a 1 on 1 session on Thursday, if that doesn't help.

Teemu Simolin

unread,
Feb 11, 2015, 6:05:44 AM2/11/15
to openlega...@googlegroups.com
Hi Roi,

What steps are needeed when not using custom navigation? I tried the following:

In the first screen I changed table screens count to 10 and key column sort index to 1. I defined target entity to a table action.
In the target entity I defined a key field.

What else is needeed to get navigation to work?

Roi Mor

unread,
Feb 11, 2015, 10:37:54 AM2/11/15
to openlega...@googlegroups.com
Teemu,

Your should also configure @ScreenNavigation drilldownValue (x, 1, etc).
But best practice is to follow the eclipse console to see what actions are performed (pageup or pagedn), and the console messages hints his the correct record is searched.
I will try to ping you tommorrow via Skype to assist.
Reply all
Reply to author
Forward
0 new messages