Hi,

pass a model with the pieces to the listView, this way it will always 
renderContexrRelative an up-to-date list.

new ListView("pieceView", piecesModel)

Have fun
Sven

Am 23. Mai 2018 16:19:11 MESZ schrieb JavaTraveler <meteor.ei...@gmail.com>:
>Hello,
>
>Does anyone know how to update a listView with an ajaxButton, after
>it's
>construction when it was empty ?
>For now, I have this :
>
>final ListView<Piece> pieceView = new ListView<Piece>("pieceView",
>pieces)
>{
>                       /**
>                        * 
>                        */
>                       private static final long serialVersionUID = 
> 1569632937178977468L;
>
>                       @Override
>                       protected void populateItem(ListItem<Piece> item) {
>                               item.add(new Label("refPiece", new 
> PropertyModel(item.getModel(),
>"refPiece")));
>                       }
>               };
>               pieceView.setOutputMarkupId(true);
>
>               
>               final WebMarkupContainer wmc = new WebMarkupContainer("wmc");
>               wmc.setOutputMarkupId(true);
>               
>               wmc.add(new AjaxSelfUpdatingTimerBehavior(Duration.seconds(5)));
>
>               wmc.add(pieceView);
>               
>               
>               final AjaxButton button2 = new AjaxButton("rechercheModele"){
>                       /**
>                        * 
>                        */
>                       private static final long serialVersionUID = 
> -4334196093047066924L;
>
>                       @Override
>                       public void onSubmit(AjaxRequestTarget target, Form<?> 
> formF) {
>                               super.onSubmit(target, formF);
>                               
>                               libPieces.clear();
>                                                       
>                               pieces = pieceDAO.getByMod(modeleModel);
>                               
>                               for (int i = 0; i < pieces.size(); i++) {
>                                       libPieces.add(i, 
> pieces.get(i).getRefPiece());
>                               }       
>                               
>                               target.add(wmc.add(pieceView));
>                               
>                               target.add(piece);
>                       }
>
>
>
>I made something similar with a dropdownchoice which works perfectly. I
>guess I'm doing something wrong. But I can't put my finger on it.
>
>Can anyone help me ?
>
>--
>Sent from:
>http://apache-wicket.1842946.n4.nabble.com/Users-forum-f1842947.html
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
>For additional commands, e-mail: users-h...@wicket.apache.org

Reply via email to