0

Reload the same page with new arguments

asked 2021-05-04 18:43:22 +0800

RomanZK gravatar image RomanZK
1 1

Let's say I am working on a contact mgt app. I have a contact List page that displays list of contacts then I have an edit contact page that allows editing of a single contact.

Now my data model gets a bit more complicated. A contact can have one or more partners. Partners are modelled as contact in my ER model.

In my edit contact page I have a list showing partners. If I want open the details of a partner (which is a contact) I want to refresh the EditContact page again this time around supplying the id of the partner.

I have implemented navigation using the example I found on fiddle "MVVM paging list detail and back navigation" You can google this. Unfortunately I am not allowed to post url's here. It has worked fine up on till now with this more complicated use case.

In this fiddle example there is MainViewModel that handles navigation. Navigation from other view models is done by issuing a global command.

In my code, I noticed that If I am on editContact page and I want to navigate to (i.e. reload) editContact page navigation does not happen.

Any ideas ? Is there a better approach to navigation in ZK ? What is the recommended approach ?

In the future we will be working on more complex data models e.g. Building, Building units e.t.c. Where self referential relations like this are common.

delete flag offensive retag edit

1 Reply

Sort by ยป oldest newest

answered 2021-05-04 20:58:36 +0800

RomanZK gravatar image RomanZK
1 1

updated 2021-05-13 12:49:24 +0800

cor3000 gravatar image cor3000
6280 2 7

In my view model

I have attempted the following logic

Map<String, Object> arguments = new HashMap<String, Object>();
arguments.put("detailsPojo", pojo);
                      arguments.put("scDetailPojo", scPojo);
                      arguments.put("bindVarPojoParam", selectedRecord);                  
                      arguments.put("parentSubBindVarPojoParam", editRecord);
                      arguments.put("subBindVarPojoParam", subBindVariable);

BindUtils.postGlobalCommand(null, null, "openSubBindVarDetailsView2", arguments);

The page does not reload.

I have also tried this

Execution exec = Executions.getCurrent();

                  HashMap arguments = (HashMap)exec.getArg();

                  arguments.put("detailsPojo", pojo);
                  arguments.put("scDetailPojo", scPojo);
                  arguments.put("bindVarPojoParam", selectedRecord);   // parentSubBindVarPojoParam                   
                  arguments.put("parentSubBindVarPojoParam", editRecord);
                  arguments.put("subBindVarPojoParam", subBindVariable);


exec.sendRedirect("");

I get the following error

java.lang.ClassCastException: java.util.Collections$EmptyMap cannot be cast to java.util.HashMap
link publish delete flag offensive edit
Your reply
Please start posting your answer anonymously - your answer will be saved within the current session and published after you log in or create a new account. Please try to give a substantial answer, for discussions, please use comments and please do remember to vote (after you log in)!

[hide preview]

Question tools

Follow

RSS

Stats

Asked: 2021-05-04 18:43:22 +0800

Seen: 8 times

Last updated: May 13 '21

Support Options
  • Email Support
  • Training
  • Consulting
  • Outsourcing
Learn More