You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by JavaTraveler <me...@gmail.com> on 2018/10/31 08:47:15 UTC

ModalWindows in a listView

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-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: ModalWindows in a listView

Posted by Francois Meillet <fr...@gmail.com>.
have a look at Component setMarkupId(String markupId)

François



> Le 31 oct. 2018 à 14:01, JavaTraveler <me...@gmail.com> a écrit :
> 
> 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-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
> 


Re: ModalWindows in a listView

Posted by JavaTraveler <me...@gmail.com>.
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-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: ModalWindows in a listView

Posted by Ernesto Reinaldo Barreiro <re...@gmail.com>.
Put modal outside repeater and reuse it?

On Wed, Oct 31, 2018, 2:01 PM JavaTraveler <meteor.eisen@gmail.com wrote:

> 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-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>

Re: ModalWindows in a listView

Posted by JavaTraveler <me...@gmail.com>.
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-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: ModalWindows in a listView

Posted by Francois Meillet <fr...@gmail.com>.
because all yours modakwindow have the same id.

François



> Le 31 oct. 2018 à 09:47, JavaTraveler <me...@gmail.com> 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&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-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
> 


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