I ended up doing it all server side - overriding onSelectionChanged* and
setting a selectedItem attribute. We then override isSelectedItem and
return true if the given item 'equals' selectedItem - must make sure
your IModel and domain classes all override equals and test for class
match and non null operand.

>-----Original Message-----
>From: Martin Grigorov [mailto:mgrigo...@apache.org]
>Sent: Friday, 25 March 2011 10:35 PM
>To: users@wicket.apache.org
>Subject: Re: Best way to periodically refresh an inmethod DataGrid?
>
>If you update the just the selected row then the selection will be
lost.
>You may try with some JavaScript gymnastics to save the selection and
>restore it later.
>Use AjaxRequestTarget.prependJavascript() for the saving code and
>.appendJavascript() for the restoring code.
>
>The JavaScript to deal with selection is different for the different
>browsers, so better find a JS library that does it for you.
>
>Good luck!
>
>On Thu, Mar 24, 2011 at 11:38 PM, Coleman, Chris <
>chris.cole...@thalesgroup.com.au> wrote:
>
>> We've got a wicket app with an inmethod DataGrid and it displays fine
and
>> we use an AjaxSelfUpdatingTimerBehaviour to update the grid every 5
>seconds.
>> That part works fine - as data changes in the database the changes
are
>> reflected in the table in the browser....
>>
>> However, if we select an item the selection dissappears when the very
>next
>> refresh occurs. How do we refresh the DataGrid in such a way that it
>> remembers its selected item after a refresh?
>>
>>
>>
>>
>>
DISCLAIMER:-------------------------------------------------------------
-
>-------------
>> This e-mail transmission and any documents, files and previous e-mail
>> messages
>> attached to it are private and confidential. They may contain
proprietary
>> or copyright
>> material or information that is subject to legal professional
privilege.
>> They are for
>> the use of the intended recipient only.  Any unauthorised viewing,
use,
>> disclosure,
>> copying, alteration, storage or distribution of, or reliance on, this
>> message is
>> strictly prohibited. No part may be reproduced, adapted or
transmitted
>> without the
>> written permission of the owner. If you have received this
transmission
>in
>> error, or
>> are not an authorised recipient, please immediately notify the sender
by
>> return email,
>> delete this message and all copies from your e-mail system, and
destroy
>any
>> printed
>> copies. Receipt by anyone other than the intended recipient should
not be
>> deemed a
>> waiver of any privilege or protection. Thales Australia does not
warrant
>or
>> represent
>> that this e-mail or any documents, files and previous e-mail messages
>> attached are
>> error or virus free.
>>
>>
------------------------------------------------------------------------
-
>-------------
>>
>>
>
>
>--
>Martin Grigorov
>jWeekend
>Training, Consulting, Development
>http://jWeekend.com <http://jweekend.com/>

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

Reply via email to