Hi Kjetil

Hmm I've only used the "simple" approach of simply having a js that showed a div over the whole page when making callbacks. EG showing a message saying loading and a gif. So you could create a behavior that did that and attach it to the dropdown.

The thing is if you want something that gives an actual percentage you will need to be able to provide that somehow and use the workerthread approach.

regards Nino

Kjetil Paulsen wrote:
Hi

Is there an easy way to show the user that things are loading in the
background when using ajax calls to populate e.g the palette component
based on a selection in a dropdown? Like changing the mousepointer or
have some kind of load indicator component indicating this to the user
based on when the ajax call starts and ends..

I've attached some code - the call to fill the palette based on the
selection in the dropdown takes some time so there I would like to hook
in and to some kind of indication to the user that data are loading...

Code..

                IModel companies = new AbstractReadOnlyModel() {
                public Object getObject() {
                    return service.findAllCompanies();
                }
                protected Object load() {
                    return null;
                }
            };

                IModel personsOnCompany = new AbstractReadOnlyModel() {
                public Object getObject() {
                    List<Person> list = new ArrayList<Person>();
                    if (myModel.getCompany() != null) {
                        list =
service.findAllPersonsForCompany(myModel.getCompany());
                    }
                    return list;
                }
                protected Object load() {
                    return null;
                }
            };

                IModel allPersons = new AbstractReadOnlyModel() {
                public Object getObject() {
                          return service.findAllPersons();

                }
                protected Object load() {
                    return null;
                }
            };

                final DropDownChoice companiesDDC =
                    new CompaniesDropDownChoice(
                            "companies",
                            new PropertyModel(MyPage.this,
"myModel.company"),
                            companies);

            final Palette personPalette = new Palette("personPalette",
                    personsOnCompany,
                    allPersons,
                    new PersonRenderer(), 20, false);

            add(companiesDDC);
            personPalette.setOutputMarkupId(true);
            add(personPalette);

            companiesDDC.add(new
AjaxFormComponentUpdatingBehavior("onchange") {
                protected void onUpdate(AjaxRequestTarget target) {
                    target.addComponent(personPalette);
                }
            });
Statnett SF, Tel. head office +47 22527000, Enterprise No. NO 962 986 633 VAT, 
www.statnett.no, [EMAIL PROTECTED]
_________________________________________________________________

This e-mail and any attached files are confidential and may be legally 
privileged. If you have received this transmission in error please notify the 
sender by reply e-mail immediately and then delete the e-mail.
E-mail transmission cannot be guaranteed to be secure or error free as 
information could be intercepted, corrupted, lost, destroyed, arrive late or 
incomplete. If verification is required please request a hard copy version. 
This e-mail message has been virus checked by the virus programs used by 
Statnett SF.
_________________________________________________________________

Save a tree - don't print this e-mail unless necessary!


--
Nino Martinez Wael
Java Specialist @ Jayway DK
http://www.jayway.dk
+45 2936 7684


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to