I currently have a DataGridView loaded inside of an AjaxLazyLoadPanel,
including the service call to get the data.

myLazyLoadPanel = new AjaxLazyLoadPanel("id", new CollectionModel<Pojo>()) {
    public Component getLazyLoadComponent(String markupId) {
        if(getDefaultModelObject() == null) {
            setDefaultModelObject(myPojoService.readAll());
        }
        return new MyDataGridView(markupId, getDefaultModel()); //ignoring
casting for simplicity
    }
}

That works great for loading the page before the service call is complete.

But now I need to add a DropDownChoice to change the collection in the data
grid via Ajax after the page is loaded. Is there anyway to get the
DataGridView to be replaced with an Ajax indicator (like on page load)
during an Ajax "onchange" event for the DropDownChoice? I've added an Ajax
indicator to the DropDownChoice, but I would like the same behavior I get on
page load for the AjaxLazyLoadPanel.

This is what I have for the drop down for starters:

myDropDownChoice.add(new AjaxFormComponentUpdateBehavior("onchange") {
    protected void onUpdate(AjaxRequestTarget target) {
        if(myDropDownChoice.getModelObject().equals(foo)) {
            myLazyLoadPanel.setDefaultModelObject(myPojoService.readFoo());
        }
        //check other selections
       target.addComponent(myLazyLoadPanel);
    }
}

I may be looking at this entirely wrong... Any suggestions?

Reply via email to