Default the listmodel just stored the index of the list of the ListView
And then gets the object from the ListViews list back by that index.
But if the list changes the index will return a different object then that ListItem was rendered with.

So what you need to do is replace that index with something else.
That is mostly the PK/ID of the object. So you keep that in your listmodel.
and then when you want the object back. You don't go to the list and get it by index but
get it by PK/ID (you don't even have to use the list at all anymore just query it)

For database dynamic list you should use in wicket extentions and then the repeater package.
There we have much better implementations for repeating things.

johan


On 7/20/06, Alex Objelean <[EMAIL PROTECTED]> wrote:

The javadoc of the getListItemModel method of the abstract class ListView
states that
"Subclasses may provide their own ListItemModel with extended
functionality. The default ListItemModel works fine with mostly static lists
where index remains valid. In cases where the underlying list changes a lot
(many users using the application), it may not longer be appropriate. In
that case your own ListItemModel implementation should use an id ( e.g. the
database' record id) to identify and load the list item model object."..

I am in situation where the list is not static and the application is used
by many users.. Can you provide a sample implementation of the
getListItemModel method for this situation?

Thank you!
--
View this message in context: http://www.nabble.com/Overriding-ListView-getListItemModel-tf1972442.html#a5414248
Sent from the Wicket - User forum at Nabble.com.


-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys -- and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Wicket-user mailing list
Wicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys -- and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Wicket-user mailing list
Wicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user

Reply via email to