Hi Sandor,

why doesn't your myDAO 'detach'(=clear) its cache automatically whenever a new item is added?

Wicket might call #detach() in a lot of circumstances, thus this has to be a very quick operation.

It's better to avoid tying your caching to your UI layer. If you're using Spring, you can add caching to your service via annotations quite easily:

https://docs.spring.io/spring/docs/4.0.x/spring-framework-reference/html/cache.html

Have fun
Sven


Am 14.11.18 um 22:38 schrieb Sandor Feher:
Hi,

Sorry for the confusing.
Let me explain it more.
Let's suppose a simple CRUD page with a single DataTable and it's
dataprovider.
I need to refresh my datatable after a new item added.

So far I did it like this:

mw = new ModalWindow("modal");
mw.setWindowClosedCallback(new ModalWindow.WindowClosedCallback() {
                 private static final long serialVersionUID = 1L;

                 @Override
                 public void onClose(AjaxRequestTarget target) {
                     dataTable.detachModels();
                     target.add(wm_bottom);
                 }
             });

In my dataprovider I reloaded data when datatable (and dataprovider) got
detached.

     @Override
     public void detach() {
           myDAO.refreshData();
     }

and every other cases when datatable filtered or cleared and so one.
And at this point AjaxSelfupdatingBehaviour comes in the picture. I can't
rely on ondetach method anymore because it's fired in every second not just
when it needed.

I hope I need a different approach to refresh my data but I did not figure
it out so far.

Regards,  Sandor

--
Sent from: http://apache-wicket.1842946.n4.nabble.com/Users-forum-f1842947.html

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org

Reply via email to