Discussion:
ModalWindows in a listView
JavaTraveler
2018-10-31 08:47:15 UTC
Permalink
Hello everyone,

I have a question. Is it possible to add modal windows in a listView. I have
tried, but it doesn't on wich line I click, the corresponding modal window
will always concern the last item of my list.
Here's how I do it :


lArt = new ListView<ArticleDto>("articles", new
LoadableDetachableModel<List&lt;ArticleDto>>() {
@Override
protected List<ArticleDto> load() {
return BusinessFactory.getArticleEjb().searchDto(ARTICLESEARCH,
ARTICLELOAD);
}
}) {
@Override
protected void populateItem(final ListItem<ArticleDto> _itemRow) {
_itemRow.setOutputMarkupId(true);
_itemRow.add(new Label("code",
_itemRow.getModelObject().getCode()));
modalWindowLibelle = new ModalWindow("modalWindowLibelle");
modalWindowLibelle.setContent(new
ModifierArticlePanel(modalWindowLibelle.getContentId(),
_itemRow.getModelObject()));
modalWindowLibelle.setTitle("Modifier le libellé d'article ?");
modalWindowLibelle.setWindowClosedCallback(new
ModalWindow.WindowClosedCallback() {
@Override
public void onClose(AjaxRequestTarget target){
target.add(tabArticles);
}
});
AjaxLink btnLib = new AjaxLink("btnLib") {
@Override
public void onClick(AjaxRequestTarget art) {
modalWindowLibelle.show(art);
}
};
btnLib.add(new Image("imgLib", new
PackageResourceReference(TemplatePage.class, "images/magnifier.png")));

modalWindowPrix = new ModalWindow("modalWindowPrix");
modalWindowPrix.setContent(new
ModifierPrixArticlePanel(modalWindowPrix.getContentId(),
_itemRow.getModelObject()));
modalWindowPrix.setTitle("Modifier le libellé d'article ?");
modalWindowPrix.setWindowClosedCallback(new
ModalWindow.WindowClosedCallback() {
@Override
public void onClose(AjaxRequestTarget target){
target.add(tabArticles);
}
});
AjaxLink btnPrix = new AjaxLink("btnPrix") {
@Override
public void onClick(AjaxRequestTarget art) {
modalWindowPrix.show(art);
}
};
btnPrix.add(new Image("imgPrix", new
PackageResourceReference(TemplatePage.class, "images/magnifier.png")));

_itemRow.add(btnLib);
_itemRow.add(btnPrix);
_itemRow.add(modalWindowLibelle);
_itemRow.add(modalWindowPrix);
};


Any ideas ?

Thank you very much in advance.

--
Sent from: http://apache-wicket.1842946.n4.nabble.com/Users-forum-f1842947.html

---------------------------------------------------------------------
To unsubscribe, e-mail: users-***@wicket.apache.org
For additional commands, e-mail: users-***@wicket.apache.org
Francois Meillet
2018-10-31 09:33:04 UTC
Permalink
because all yours modakwindow have the same id.

François
Post by JavaTraveler
Hello everyone,
I have a question. Is it possible to add modal windows in a listView. I have
tried, but it doesn't on wich line I click, the corresponding modal window
will always concern the last item of my list.
lArt = new ListView<ArticleDto>("articles", new
LoadableDetachableModel<List&lt;ArticleDto>>() {
@Override
protected List<ArticleDto> load() {
return BusinessFactory.getArticleEjb().searchDto(ARTICLESEARCH,
ARTICLELOAD);
}
}) {
@Override
protected void populateItem(final ListItem<ArticleDto> _itemRow) {
_itemRow.setOutputMarkupId(true);
_itemRow.add(new Label("code",
_itemRow.getModelObject().getCode()));
modalWindowLibelle = new ModalWindow("modalWindowLibelle");
modalWindowLibelle.setContent(new
ModifierArticlePanel(modalWindowLibelle.getContentId(),
_itemRow.getModelObject()));
modalWindowLibelle.setTitle("Modifier le libellé d'article ?");
modalWindowLibelle.setWindowClosedCallback(new
ModalWindow.WindowClosedCallback() {
@Override
public void onClose(AjaxRequestTarget target){
target.add(tabArticles);
}
});
AjaxLink btnLib = new AjaxLink("btnLib") {
@Override
public void onClick(AjaxRequestTarget art) {
modalWindowLibelle.show(art);
}
};
btnLib.add(new Image("imgLib", new
PackageResourceReference(TemplatePage.class, "images/magnifier.png")));
modalWindowPrix = new ModalWindow("modalWindowPrix");
modalWindowPrix.setContent(new
ModifierPrixArticlePanel(modalWindowPrix.getContentId(),
_itemRow.getModelObject()));
modalWindowPrix.setTitle("Modifier le libellé d'article ?");
modalWindowPrix.setWindowClosedCallback(new
ModalWindow.WindowClosedCallback() {
@Override
public void onClose(AjaxRequestTarget target){
target.add(tabArticles);
}
});
AjaxLink btnPrix = new AjaxLink("btnPrix") {
@Override
public void onClick(AjaxRequestTarget art) {
modalWindowPrix.show(art);
}
};
btnPrix.add(new Image("imgPrix", new
PackageResourceReference(TemplatePage.class, "images/magnifier.png")));
_itemRow.add(btnLib);
_itemRow.add(btnPrix);
_itemRow.add(modalWindowLibelle);
_itemRow.add(modalWindowPrix);
};
Any ideas ?
Thank you very much in advance.
--
Sent from: http://apache-wicket.1842946.n4.nabble.com/Users-forum-f1842947.html
---------------------------------------------------------------------
---------------------------------------------------------------------
To unsubscribe, e-mail: users-***@wicket.apache.org
For additional commands, e-mail: users-***@wicket.apache.org
JavaTraveler
2018-10-31 13:01:16 UTC
Permalink
Ok, so how would you do it ?

--
Sent from: http://apache-wicket.1842946.n4.nabble.com/Users-forum-f1842947.html

---------------------------------------------------------------------
To unsubscribe, e-mail: users-***@wicket.apache.org
For additional commands, e-mail: users-***@wicket.apache.org
Francois Meillet
2018-10-31 13:29:48 UTC
Permalink
have a look at Component setMarkupId(String markupId)

François
Post by JavaTraveler
Ok, so how would you do it ?
--
Sent from: http://apache-wicket.1842946.n4.nabble.com/Users-forum-f1842947.html
---------------------------------------------------------------------
Ernesto Reinaldo Barreiro
2018-10-31 13:53:36 UTC
Permalink
Put modal outside repeater and reuse it?
Post by JavaTraveler
Ok, so how would you do it ?
--
http://apache-wicket.1842946.n4.nabble.com/Users-forum-f1842947.html
---------------------------------------------------------------------
JavaTraveler
2018-10-31 14:46:48 UTC
Permalink
Yes thank you. By putting it outside and setting the content in the link, it
worked. Thank you very much :)

--
Sent from: http://apache-wicket.1842946.n4.nabble.com/Users-forum-f1842947.html

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

Loading...