because all yours modakwindow have the same id. François
> Le 31 oct. 2018 à 09:47, JavaTraveler <[email protected]> a écrit : > > 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<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: [email protected] > For additional commands, e-mail: [email protected] > --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
