amekha
amekha

Reputation: 31

Wicket: AjaxLazyLoadPanel in form

I am working with wicket 8, and would be glad of some help! I have a form with several fields, the first is text and then three dropdowns. One of the dropdowns is very heavy, and I have wrapped it in an AjaxLazyLoadPanel.

When the form renders, it shows a spinner in place of the heavy dropdown, and while it loads I cannot access the other fields. For example if i try to type something in the text field, the page appears to be not responding, and as soon as the Heavy drop-down is rendered, I will see the text I entered all at once.

Is this how its supposed to behave or did i miss something? My dropdown code looks like this -

private Panel createLazyLoadPanel() {
    return new AjaxLazyLoadPanel<Component>("panel") {

        @Override
        public Component getLazyLoadComponent(String markupId) {
            Panel customPanel = new CustomPanel(markupId);
            customPanel.add(heavyDropDownField);
            return customPanel ;
        }

    };
}

Thanks!

Upvotes: 1

Views: 88

Answers (1)

Andrea Del Bene
Andrea Del Bene

Reputation: 2511

it's just an idea but maybe you need to execute the heavy work for heavyDropDownField in a separate thread (with a ExecutorService for example) and override AjaxLazyLoadPanel#isContentReady to decide when heavyDropDownField is actually ready. In this way you should avoid to block your page while your panel is loading.

Upvotes: 3

Related Questions