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 <[email protected]>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.
>

Reply via email to