I tried what you suggested i.e. swap a different fragment in but I can't
seem to get it to work. I have the following. When I click on the delete
link I want fragment1 to be replaced with fragment2. However fragment2
remains and is shifted to the right. What am I missing or doing wrong?
Thanks again.

         <tr wicket:id="rows">
            <span wicket:id="panel"></span>
          </tr>
      </table>

      <wicket:fragment wicket:id="fragment1">
          <td wicket:id="userSearchPanel"></td>
          <td><input type="checkbox" wicket:id="admin"/></td>
          <td wicket:id="deletePanel"></td>
      </wicket:fragment>
      <wicket:fragment wicket:id="fragment2"><td><span wicket:id="label"></
span></td></wicket:fragment>

public class Fragment1 extends Fragment {
        public Fragment1(String id, String markupId, ...) {
            super(id, markupId);
            add(new ModalWindowPanel("userSearchPanel", value));
            add(new CheckBox("admin",...);
            add(new DeletePanel("deletePanel", ..));
        }
    }

public class Fragment2 extends Fragment {
      ..
            add(new Label("label", "Hello, World!"));
        }
    }

private class DeletePanel extends Panel {
      deleteItem = new AjaxLink("deleteItem") {

                 public void onClick(AjaxRequestTarget target) {
            f2 = new Fragment2("panel", "fragment2");
            DeletePanel.this.getParent().getParent().replace(f2);
            target.addComponent(listContainer);//WebMarkupContainer



                                                                           
             "Igor                                                         
             Vaynberg"                                                     
             <igor.vaynb                                                To 
             [EMAIL PROTECTED]         wicket-user@lists.sourceforge.net        
 
             om>                                                        cc 
             Sent by:                                                      
             wicket-user                                           Subject 
             [EMAIL PROTECTED]         Re: [Wicket-user] How do I show/hide row 
 
             sts.sourcef                                                   
             orge.net                                                      
                                                                           
                                                                           
             04/23/2007                                                    
             10:47 AM                                                      
                                                                           
                                                                           
               Please                                                      
             respond to                                                    
             wicket-user                                                   
             @lists.sour                                                   
             ceforge.net                                                   
                                                                           
                                                                           




what you have below seems pretty reasonable. if it is more then just links
changing i would swap a different fragment in, but it looks like overkill
for your case.

-igor

On 4/22/07, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
  I have a table which contains a list of users. At the end of each row
  there
  is an delete/undo link. When the user clicks delete I want to hide the
  row
  and replace it with only the undo link. What would be the best way to do
  this? Thanks for your time.

              view = new ListView("rows", data) {
                    public void populateItem(ListItem listItem) {
                          UserType value = (UserType
  )listItem.getModelObject();
                          listItem.add(new
  ModalWindowPanel("userSearchPanel", value));

                          listItem.add(new CheckBox("admin", new Model(new
  Boolean(value.isAdmin()))));
                          listItem.add(new
  DeleteUndoPanel("deleteUndoPanel",
  listItem.getModel()));
                    }
              };


              private class DeleteUndoPanel extends Panel {


              public DeleteUndoPanel(String id, final IModel model) {
                    super(id, model);
                    setOutputMarkupId(true);
                    final UserType type = (UserType)this.getModelObject();

                    undoItem = new AjaxLink("undoItem") {

                          @Override
                                public boolean isVisible() {
                          ....
                           }

                          public void onClick(AjaxRequestTarget target) {
                                type.setDelete(false);
                                target.addComponent(DeleteUndoPanel.this);
                          }
                    };
                    ..
                    deleteItem = new AjaxLink("deleteItem") {


  ********************
  NOTICE OF CONFIDENTIALITY
  This communication including any information transmitted with it is
  intended only for the use of the addressees and is confidential.
  If you are not an intended recipient or responsible for delivering
  the message to an intended recipient, any review, disclosure,
  conversion to hard copy, dissemination, reproduction or other use
  of any part of this communication is strictly prohibited, as is the
  taking or omitting of any action in reliance upon this communication.
  If you receive this communication in error or without authorization
  please notify us immediately by return e-mail or otherwise and
  permanently delete the entire communication from any computer,
  disk drive, or other storage medium.

  If the above disclaimer is not properly readable, it can be found at
  www.td.com/legal

  AVERTISSEMENT DE CONFIDENTIALITE
  Ce courriel, ainsi que tout renseignement ci-inclus, destiné uniquement
  aux destinataires susmentionnés,  est confidentiel.  Si vous
  n'êtes pas le destinataire prévu ou un agent responsable de la
  livraison de ce courriel, tout examen, divulgation, copie, impression,
  reproduction, distribution, ou autre utilisation d'une partie de ce
  courriel est strictement interdit de même que toute intervention ou
  abstraction à cet égard.  Si vous avez reçu ce message par erreur ou
  sans autorisation, veuillez en aviser immédiatement l'expéditeur par
  retour de courriel ou par un autre moyen et supprimer immédiatement
  cette communication entière de tout système électronique.

  Si l'avis de non-responsabilité ci-dessus n'est pas lisible, vous
  pouvez le consulter à www.td.com/francais/legale
  -------------------------------------------------------------------------
  This SF.net email is sponsored by DB2 Express
  Download DB2 Express C - the FREE version of DB2 express and take
  control of your XML. No limits. Just data. Click to get it now.
  http://sourceforge.net/powerbar/db2/
  _______________________________________________
  Wicket-user mailing list
  Wicket-user@lists.sourceforge.net
  https://lists.sourceforge.net/lists/listinfo/wicket-user
-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Wicket-user mailing list
Wicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user


-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Wicket-user mailing list
Wicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user

Reply via email to