You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by pi...@netcourrier.com on 2009/05/02 11:26:12 UTC
listview and windowmodal
hi, i'm a beginner in Wicket and i'm trying this framework.
first i'm building un CRUD application for users.
I have a UserBasePage listing all users using a listView.
each line is made of the name of the user and an edit link.
All i want to do is to edit the user properties in a modal window. i can use an instance of WindowModal for each user, but i feel i made a mistake : too much memory consuption.
Is there a way to create only one modal window and use it for all my users ?
right now, i'm trying something like this but the modal window is only populated with le last user (it's obvious, but i have the feeling i'm missing something but i can't find what ... ):
------------------------------------------------------------------------------
final ModalWindow modal1;
public UserPage() {
ListView lv = new ListView("menu", new ListModel()) {
@Override
protected void populateItem(ListItem item) {
final User user = (User) item.getModelObject();
modal1.setPageCreator(new ModalWindow.PageCreator() {
public Page createPage() {
log.debug("create page");
return new UserEditPage(user);
}
});
item.add(new AjaxLink("updateuser") {
@Override
public void onClick(AjaxRequestTarget target) {
modal1.show(target);
}
});
}
};
------------------------------------------------------------------------------
thx,
Pickeu
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org
Re: listview and windowmodal
Posted by Per Newgro <pe...@gmx.ch>.
pickeu@netcourrier.com schrieb:
> hi, i'm a beginner in Wicket and i'm trying this framework.
>
> first i'm building un CRUD application for users.
>
> I have a UserBasePage listing all users using a listView.
> each line is made of the name of the user and an edit link.
>
> All i want to do is to edit the user properties in a modal window. i can use an instance of WindowModal for each user, but i feel i made a mistake : too much memory consuption.
> Is there a way to create only one modal window and use it for all my users ?
>
> right now, i'm trying something like this but the modal window is only populated with le last user (it's obvious, but i have the feeling i'm missing something but i can't find what ... ):
>
> ------------------------------------------------------------------------------
>
> final ModalWindow modal1;
>
> public UserPage() {
>
> ListView lv = new ListView("menu", new ListModel()) {
> @Override
> protected void populateItem(ListItem item) {
> final User user = (User) item.getModelObject();
>
> modal1.setPageCreator(new ModalWindow.PageCreator() {
> public Page createPage() {
> log.debug("create page");
> return new UserEditPage(user);
> }
> });
>
>
> item.add(new AjaxLink("updateuser") {
> @Override
> public void onClick(AjaxRequestTarget target) {
> modal1.show(target);
> }
> });
>
> }
> };
>
> ------------------------------------------------------------------------------
>
> thx,
>
> Pickeu
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>
Create the modalwindow outside of listview (in page). Set the the user
provided by item to the modal window.
That should do the trick.
Cheers
Per
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org