Note that there are some explanatory texts on larger screens.

plurals
  1. POJava Wicket AjaxFallbackLink needing double click after becoming visible
    primarykey
    data
    text
    <p>I have two containers, BEFORE and AFTER. When the page loads up, BEFORE is visible and AFTER is not.</p> <p>BEFORE contains an AjaxFallbackLink that redraws BEFORE and AFTER but makes BEFORE invisible and AFTER visible, i.e. a visibility trigger.</p> <p>I also have an AjaxFallbackLink inside AFTER that does the reverse: redraws BEFORE and AFTER but makes BEFORE visible and AFTER invisible.</p> <p>The problem: the link inside AFTER needs two clicks to have the panels redraw themselves when I should only need one. I've set setOutputMarkupPlaceholderTag to true on every component I can find, but still I need two clicks on the AFTER link to have the panels redraw themselves.</p> <p>Is there a way to resolve this?</p> <p>Here's some (simplified) code:</p> <pre><code>private class ViewDatesFragment extends Fragment&lt;Campaign&gt; { private ViewDatesFragment(final MarkupContainer markupProvider) { super("flightNoDates", "viewDatesFragment", markupProvider); add(new AddDatesLink()); setOutputMarkupPlaceholderTag(true); } private class AddDatesLink extends AjaxFallbackLink&lt;Campaign&gt; { private AddDatesLink() { super("addDates"); add(new Label("startDate", "This is the start date").setOutputMarkupPlaceholderTag(true)); setOutputMarkupPlaceholderTag(true); } @Override public void onClick(final AjaxRequestTarget target) { target.addComponent(viewDatesContainer.setVisible(false)); target.addComponent(editDatesContainer.setVisible(true)); } } } private class EditDatesFragment extends Fragment&lt;Campaign&gt; { private EditDatesFragment(final MarkupContainer markupProvider) { super("flightDates", "editDatesFragment", markupProvider); add(new CancelDatesLink().setOutputMarkupPlaceholderTag(true)); setOutputMarkupPlaceholderTag(true); } private class CancelDatesLink extends AjaxFallbackLink { private CancelDatesLink() { super("cancelDates"); add(new Label("cancelDatesText", "cancel").setOutputMarkupPlaceholderTag(true)); setOutputMarkupPlaceholderTag(true); } @Override public void onClick(final AjaxRequestTarget target) { target.addComponent(viewDatesContainer.setVisible(true)); target.addComponent(editDatesContainer.setVisible(false)); } } } </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload