Of course  Here is part of the code

The hiercarchy is
webpage
  ----  border
        ---------  (WebMarkupContainer)  RMAsContainer  rmaList
                    ----- PageableListView rmaView ,   AjaxPagingNavigator



public class RMARecords extends WebPage {
private static final long serialVersionUID = 1L;

private Request rmaRequest = new Request();

private RequestDetail requestDetail;

private RMAsContainer rmaList;

private PageableListView rmaView;

private WebMarkupContainer dContainer;

public RMARecords(final PageParameters pps) {
 Border border = new RMABorder("rmaBorder");
 add(border);

 rmaList = new RMAsContainer("showRequests");
 border.add(rmaList);

 rmaList.add(new AjaxPagingNavigator("navigator", rmaView) {
  @Override
  protected void onAjaxEvent(AjaxRequestTarget target) {
   target.addComponent(rmaList);
  }
 });

 dContainer = new WebMarkupContainer("DContainer");
 dContainer.setOutputMarkupId(true);

 requestDetail = new RequestDetail("requestDetail");
 requestDetail.setVisible(false);

 dContainer.add(requestDetail);

 border.add(dContainer);

}





class RMAsContainer extends WebMarkupContainer {

 public RMAsContainer(String id) {
  super(id);

  setOutputMarkupId(true);

  IModel itemList = new LoadableDetachableModel() {
   protected Object load() {
    String email = SecurityContextHolder.getContext()
      .getAuthentication().getName();
    return ((RMAApplication) getApplication()).getRMAService()
      .getRMAs(email);
   }
  };

  add(rmaView = new PageableListView("request", itemList, 10) {
   protected void populateItem(ListItem item) {
    // display the text of the item
    Request req = (Request) item.getModelObject();
    String time = req.getDate().toString().substring(0, 19);
    AjaxLink idLink = new IDLink("idLink", req.getId());
    idLink.add(new Label("id", req.getId().toString()));
    item.add(idLink);
    item.add(new Label("time", time));
    item.add(new Label("reference", req.getLine_reference()));
    item.add(new Label("status", req.getStatus()));
    item.add(new Label("note", req.getNote()));

   }
  });

 }

 class IDLink extends AjaxLink {
  Long reqid;

  public IDLink(String id, Long reqid) {
   super(id);
   this.setOutputMarkupId(true);
   this.reqid = reqid;
  }

  @Override
  public void onClick(AjaxRequestTarget target) {
   if (reqid != null) {
    setRmaRequest(((RMAApplication) getApplication())
      .getRMAService().getRequestByID(reqid));
   }
   requestDetail.setVisible(true);
   target.addComponent(dContainer);

  }

 }

}
}


On 7/6/07, Eelco Hillenius <[EMAIL PROTECTED]> wrote:

> I'm using wicket 1.2.6.
>
> JS error 'Object expected' in html code happens when
>
>  I first submit a form (no matther it is submitted from ajax button or
> normal button),
>
>  then click the page link ( there are AjaxPagingNavigator in this page)
>
> finally I click the ajax component,   error happens.
>
>
> Further more, after more testings, I found errors also happened when I
> click AjaxPagingNavigator  twice or three times, then click page
link  to
> view page which contains ajax components.

Could you show us some of your code?

Eelco

-------------------------------------------------------------------------
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

package rmapage;

import java.util.ArrayList;
import java.util.List;

import org.acegisecurity.context.SecurityContextHolder;

import rmahib.model.Address;
import rmahib.model.Customer;
import rmahib.model.Request;

import wicket.PageParameters;
import wicket.ajax.AjaxRequestTarget;
import wicket.ajax.markup.html.AjaxLink;
import wicket.ajax.markup.html.navigation.paging.AjaxPagingNavigator;
import wicket.markup.html.WebMarkupContainer;
import wicket.markup.html.WebPage;
import wicket.markup.html.basic.Label;
import wicket.markup.html.border.Border;
import wicket.markup.html.list.ListItem;
import wicket.markup.html.list.ListView;
import wicket.markup.html.list.PageableListView;
import wicket.model.IModel;
import wicket.model.LoadableDetachableModel;
import wicket.model.PropertyModel;

public class RMARecords extends WebPage {
        private static final long serialVersionUID = 1L;

        private Request rmaRequest = new Request();

        private boolean detailVisable = false;

        private RequestDetail requestDetail;

        private RMAsContainer rmaList;

        private PageableListView rmaView;
        
        private WebMarkupContainer dContainer;

        public RMARecords(final PageParameters pps) {
                Border border = new RMABorder("rmaBorder");
                add(border);

                rmaList = new RMAsContainer("showRequests");
                border.add(rmaList);

                rmaList.add(new AjaxPagingNavigator("navigator", rmaView) {
                        @Override
                        protected void onAjaxEvent(AjaxRequestTarget target) {
                                target.addComponent(rmaList);
                        }
                });
                
                dContainer = new WebMarkupContainer("DContainer");
                dContainer.setOutputMarkupId(true);

                requestDetail = new RequestDetail("requestDetail");
                requestDetail.setVisible(false);
                
                dContainer.add(requestDetail);

                border.add(dContainer);

        }

        class ItemsContainer extends WebMarkupContainer {

                public ItemsContainer(String id) {
                        super(id);
                        setOutputMarkupId(true);
                        System.out.println("items update");
                        IModel itemList = new LoadableDetachableModel() {
                                protected Object load() {
                                        return getItems();
                                }
                        };

                        add(new ListView("item", itemList) {
                                protected void populateItem(ListItem item) {
                                        // display the text of the item
                                        item.add(new Label("item_category", new 
PropertyModel(item
                                                        .getModel(), 
"product.category.name")));
                                        item.add(new Label("item_product", new 
PropertyModel(item
                                                        .getModel(), 
"product.description")));
                                        item.add(new Label("item_amount", new 
PropertyModel(item
                                                        .getModel(), 
"quantity")));
                                        item.add(new Label("item_reason", new 
PropertyModel(item
                                                        .getModel(), 
"return_reason")));

                                }
                        });
                }

        }

        class RequestDetail extends WebMarkupContainer {

                private AddressContainer addrContainer;

                private ItemsContainer itemsContainer;

                public RequestDetail(String id) {
                        super(id);

                        System.out.println("Request Detail");

                        setOutputMarkupId(true);

                        Label email = new Label("r_email", new 
PropertyModel(this,
                                        "r_email"));
                        email.setOutputMarkupId(true);

                        Label reference = new Label("r_lineReference", new 
PropertyModel(
                                        this, "r_lineReference"));
                        reference.setOutputMarkupId(true);

                        Label time = new Label("r_time", new 
PropertyModel(this, "r_time"));
                        time.setOutputMarkupId(true);

                        Label status = new Label("r_status", new 
PropertyModel(this,
                                        "r_status"));
                        status.setOutputMarkupId(true);

                        Label note = new Label("r_note", new 
PropertyModel(this, "r_note"));
                        note.setOutputMarkupId(true);

                        addrContainer = new AddressContainer("address");

                        itemsContainer = new ItemsContainer("showItems");

                        add(email);
                        add(reference);
                        add(time);
                        add(status);
                        add(note);
                        add(addrContainer);

                        add(itemsContainer);

                }

                public String getR_email() {
                        Customer cust = getRmaRequest().getCustomer();

                        return cust != null ? cust.getEmail() : "";
                }

                public String getR_lineReference() {
                        return getRmaRequest().getLine_reference();
                }

                public String getR_time() {

                        return 
getRmaRequest().getDate().toString().substring(0, 19);
                }

                public String getR_status() {

                        return getRmaRequest().getStatus();
                }

                public String getR_note() {

                        return getRmaRequest().getNote();
                }

        }

        class AddressContainer extends WebMarkupContainer {

                private static final long serialVersionUID = 1L;

                public AddressContainer(String id) {
                        super(id);
                        this.setOutputMarkupId(true);

                        Label label;

                        label = new Label("ship_from_line1", new 
PropertyModel(this,
                                        "ship_from_addr.line1"));
                        label.setOutputMarkupId(true);
                        add(label);
                        label = new Label("ship_from_line2", new 
PropertyModel(this,
                                        "ship_from_addr.line2"));
                        label.setOutputMarkupId(true);
                        add(label);
                        label = new Label("ship_from_city", new 
PropertyModel(this,
                                        "ship_from_addr.city"));
                        label.setOutputMarkupId(true);
                        add(label);
                        label = new Label("ship_from_postcode", new 
PropertyModel(this,
                                        "ship_from_addr.postcode"));
                        label.setOutputMarkupId(true);
                        add(label);
                        label = new Label("ship_from_country", new 
PropertyModel(this,
                                        "ship_from_addr.country"));
                        label.setOutputMarkupId(true);
                        add(label);

                        label = new Label("bill_to_line1", new 
PropertyModel(this,
                                        "bill_to_addr.line1"));
                        label.setOutputMarkupId(true);
                        add(label);
                        label = new Label("bill_to_line2", new 
PropertyModel(this,
                                        "bill_to_addr.line2"));
                        label.setOutputMarkupId(true);
                        add(label);
                        label = new Label("bill_to_city", new 
PropertyModel(this,
                                        "bill_to_addr.city"));
                        label.setOutputMarkupId(true);
                        add(label);
                        label = new Label("bill_to_postcode", new 
PropertyModel(this,
                                        "bill_to_addr.postcode"));
                        label.setOutputMarkupId(true);
                        add(label);
                        label = new Label("bill_to_country", new 
PropertyModel(this,
                                        "bill_to_addr.country"));
                        label.setOutputMarkupId(true);
                        add(label);
                }

                public Address getShip_from_addr() {
                        Address ship_from_addr = getRmaRequest().getShip_from();
                        if (ship_from_addr == null)
                                ship_from_addr = new Address();

                        return ship_from_addr;

                }

                public Address getBill_to_addr() {
                        Address bill_to_addr = getRmaRequest().getBill_to();

                        if (bill_to_addr == null)
                                bill_to_addr = new Address();
                        return bill_to_addr;
                }
        }

        class RMAsContainer extends WebMarkupContainer {

                public RMAsContainer(String id) {
                        super(id);

                        setOutputMarkupId(true);

                        IModel itemList = new LoadableDetachableModel() {
                                protected Object load() {
                                        String email = 
SecurityContextHolder.getContext()
                                                        
.getAuthentication().getName();
                                        return ((RMAApplication) 
getApplication()).getRMAService()
                                                        .getRMAs(email);
                                }
                        };

                        add(rmaView = new PageableListView("request", itemList, 
10) {
                                protected void populateItem(ListItem item) {
                                        // display the text of the item
                                        Request req = (Request) 
item.getModelObject();
                                        String time = 
req.getDate().toString().substring(0, 19);
                                        AjaxLink idLink = new IDLink("idLink", 
req.getId());
                                        idLink.add(new Label("id", 
req.getId().toString()));
                                        item.add(idLink);
                                        item.add(new Label("time", time));
                                        item.add(new Label("reference", 
req.getLine_reference()));
                                        item.add(new Label("status", 
req.getStatus()));
                                        item.add(new Label("note", 
req.getNote()));

                                }
                        });

                }

                class IDLink extends AjaxLink {
                        Long reqid;

                        public IDLink(String id, Long reqid) {
                                super(id);
                                this.setOutputMarkupId(true);
                                this.reqid = reqid;
                        }

                        @Override
                        public void onClick(AjaxRequestTarget target) {
                                if (reqid != null) {
                                        setRmaRequest(((RMAApplication) 
getApplication())
                                                        
.getRMAService().getRequestByID(reqid));
                                }
                                requestDetail.setVisible(true);
                                target.addComponent(dContainer);

                        }

                }

        }

        public List getItems() {
                List list = new ArrayList(getRmaRequest().getItems());
                return list;
        }

        public Request getRmaRequest() {
                return rmaRequest;
        }

        public void setRmaRequest(Request r) {
                rmaRequest = r;
        }

        public boolean isDetailVisable() {
                return detailVisable;
        }

        public void setDetailVisable(boolean detailVisable) {
                this.detailVisable = detailVisable;
        }

}
Title: RMA Records
RMA ID Time Line Reference Status Note
[ID] [Time] [Reference] [Status] [Note]
[dataview navigator]


email

RMA Time

Line Reference

Ship From  
Address Line1: Line1
Address Line2: Line2
City: City
Postcode: Postcode
Country: country
Bill To  
Address Line1: Line1
Address Line2: Line2
City: City
Postcode: Postcode
Country: Country

RMA Request Detail

Category Product Quantity Reason
item_category item_product item_amount item_reason

status

note

-------------------------------------------------------------------------
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