Thanks for the answer, Ernesto. A message has quite complex layout, it would be a lot of work to redo it in json. And I lose all benefits of wicket tester... Yes, that's that I mean by fighting the wicket, do everything manually, not using the wicket... Is it only solution? It worries me because I have to rewrite quite a few such pages - if a page has a lot of data, I cannot use wicket's AJAX abilities.
On 29 December 2011 15:06, Ernesto Reinaldo Barreiro <reier...@gmail.com>wrote: > Anatoly, > > I would do more or less the following > > 1-Created a panel with an AbstractAjaxBehavior on it. > 2-Use that behavior as context for rendering JSON format and handling row > clicks. > 3-Build the list using JSON+JavaScript. Each row could be built out of JSON > data: when panel is loaded use some JavaScript to query back the behavior > for JSON and build rows using that data. The onClick of the each button > would point to the same AJAX behavior but pass the "index" of the row as > parameter. > > This way you would have a very lightweight component. > > Regards, > > Ernesto > > > On Thu, Dec 29, 2011 at 3:48 PM, Anatoly Kupriyanov <kan....@gmail.com > >wrote: > > > Hi everybody! > > > > I have a page which displays long list of messages. I use > > LoadableDetachableModel for the list view, because it should display the > > latest messages each time page renders. Each message has a ajax button to > > make some action on the message. Each time I click the button, wicket > loads > > the list, looks up for the message (by index? or how?) and invokes my > > "onClick" method. > > It doesn't look great. What is a better approach to do it? > > I want minimize memory usage (don't keep in session list of all messages) > > and avoid querying the whole list each time from database (moreover, it > is > > changing!). The wise solution is to somehow refer a concrete button to a > > message by the message PK and query only the message, but I don't know an > > elegant way to do it, only fighting with the wicket approach. > > > > -- > > WBR, Anatoly. > > > -- WBR, Anatoly.