Hi Chris,

I am using a heuristic for an optimization problem and this takes about
> 5-10 seconds.
> So it might be a good idea to use a future task to run this service, which
> receives the data (list of object) in the end.
> In the beginning, I would like to initialize the model with an empty list
> so that the page is displayed fast, and in parallel execute a future task;
> as soon as the service has some results, exchanging the model against the
> data returned.
>
> I have looked at the example described here:
> https://gist.github.com/jonnywray/636875 <
> https://gist.github.com/jonnywray/636875>
>
> The future is called correctly, but how can the component/panel be updated
> via the onPostSuccess(AjaxRequestTarget target) method?
>

target.add(yourPanel) ?
Caution: it will call model#getObject. Given your explanation I don't think
your model is a LDM. Just be aware...


> By the way, what is the difference when setting the model via constructor
> (e.g. new Panel(id, model)) or via setDefaultModel method?
>

There should no be differences. However, if you change the model object
dynamically/afterward, you have to use #set[Default]ModelObject instead of
#set[Default]Model.


> With the first, the default model is still null.
>

No sure to follow here, because you said you initialized the model with an
empty list... So neither the model and the modelobject should be null...


>
> Thanks, Chris
>
>
>

Reply via email to