You need to add the spans to the target in onClick, and the links need to
have their outputMarkupId set to true, as follows (I've added the ***
lines):
final Link showMineLink =new AjaxFallbackLink("trafficreportlistmine") {
public void onClick(AjaxRequestTarget target) {
AjaxFallbackDefaultDataTable replacement = new
AjaxFallbackDefaultDataTable("trafficreportlistdatatable", columns, new
ReportListProvider("Traffic", "mine"), 8);
//this.replaceWith(replacement);
replacement.setOutputMarkupId(true);
datatable.replaceWith(replacement);
showMineSpan.setVisible(true);
showAllSpan.setVisible(false);
target.addComponent(replacement);
***target.addComponent(showMineSpan);
***target.addComponent(showAllSpan);
}
};
*** showMineLink.setOutputMarkupId(true);
Then do the same with the other link.
Dane
On Thu, Oct 22, 2009 at 4:42 PM, wicketnewuser <[email protected]> wrote:
>
> It's suppose to hide Show All and show Show Mine when I click on Show All
> but
> that doesn't happen. on the onclick of showmine it is supposed to be
> showMineSpan.setVisible(false);
> showAllSpan.setVisible(true);
> instead of what I listed earlier as
> showMineSpan.setVisible(true);
> showAllSpan.setVisible(false);
>
>
> wicketnewuser wrote:
> >
> > Hi tried to follow this and having problem with it . Could someone please
> > let me know what I'm doing wrong
> > Here is the code
> > package com.swishmark.tugboat;
> >
> > import java.util.ArrayList;
> > import java.util.HashMap;
> > import java.util.List;
> >
> > import org.apache.wicket.PageParameters;
> > import org.apache.wicket.Session;
> > import org.apache.wicket.markup.html.WebMarkupContainer;
> > import org.apache.wicket.markup.html.basic.Label;
> > import org.apache.wicket.markup.html.link.Link;
> > import org.apache.wicket.markup.html.panel.Panel;
> > import org.apache.wicket.markup.repeater.Item;
> > import org.apache.wicket.ajax.AjaxRequestTarget;
> > import org.apache.wicket.ajax.markup.html.AjaxFallbackLink;
> > import
> >
> org.apache.wicket.extensions.ajax.markup.html.repeater.data.table.AjaxFallbackDefaultDataTable;
> > import
> >
> org.apache.wicket.extensions.markup.html.repeater.data.grid.ICellPopulator;
> > import
> > org.apache.wicket.extensions.markup.html.repeater.data.table.IColumn;
> > import
> >
> org.apache.wicket.extensions.markup.html.repeater.data.table.PropertyColumn;
> > import org.apache.wicket.model.IModel;
> > import org.apache.wicket.model.Model;
> >
> > import com.swishmark.tugboat.util.DateTimePropertyColumn;
> > import com.swishmark.tugboat.util.LinkPropertyColumn;
> > import com.swishmark.tugboat.util.ReportListProvider;
> > import com.swishmark.tugboat.util.TugboatReport;
> >
> > // http://cwiki.apache.org/WICKET/simple-sortable-datatable-example.html
> > // AJAX:
> >
> http://www.wicket-library.com/wicket-examples/repeater/?wicket:bookmarkablePage=:org.apache.wicket.examples.repeater.AjaxDataTablePage
> >
> > public class TrafficReportListPanel extends Panel {
> >
> > Integer contactId;
> >
> > public TrafficReportListPanel(String id, final String include) {
> > super(id);
> >
> > final List<IColumn<?>> columns = new
> ArrayList<IColumn<?>>();
> >
> > columns.add(new PropertyColumn(new Model("Report ID"),
> "reportId",
> > "reportId"));
> > columns.add(new PropertyColumn(new Model("Contact Name"),
> "contactName",
> > "contactName"));
> >
> > //
> http://www.mail-archive.com/[email protected]/msg16575.html
> > if (include != null && include.equals("running")){
> > columns.add(new PropertyColumn(new Model("Report
> Name"), "reportName",
> > "reportName"));
> > } else {
> > columns.add(new LinkPropertyColumn(new Model("Report
> Name"),
> > "reportName", "reportName") {
> >
> > @Override
> > public void onClick(Item item, String componentId,
> IModel model) {
> > HashMap<String, Integer> params = new
> HashMap<String, Integer>();
> > TugboatReport selectedReport =
> (TugboatReport) model.getObject();
> > params.put("reportId",
> selectedReport.getReportId());
> >
> >
> > setResponsePage( ReportResultsPage.class,
> new
> > PageParameters(params));
> >
> > }
> >
> > });
> > }
> > columns.add(new DateTimePropertyColumn(new Model("Start
> Time"),
> > "startTime", "startTime"));
> > columns.add(new DateTimePropertyColumn(new Model("End
> Time"), "endTime",
> > "endTime"));
> > columns.add(new PropertyColumn(new Model("Duration"),
> "duration",
> > "duration"));
> >
> >
> > final AjaxFallbackDefaultDataTable datatable = new
> > AjaxFallbackDefaultDataTable("trafficreportlistdatatable", columns, new
> > ReportListProvider("Traffic", include), 8);
> > add(datatable);
> > final WebMarkupContainer showMineSpan = new
> > WebMarkupContainer("showMineSpan");
> > final WebMarkupContainer showAllSpan = new
> > WebMarkupContainer("showAllSpan");
> > final Link showAllLink = new
> > AjaxFallbackLink("trafficreportlistshowall") {
> > public void onClick(AjaxRequestTarget
> target) {
> > AjaxFallbackDefaultDataTable
> replacement = new
> > AjaxFallbackDefaultDataTable("trafficreportlistdatatable", columns, new
> > ReportListProvider("Traffic", "all"), 8);
> > //this.replaceWith(replacement);
> >
> replacement.setOutputMarkupId(true);
> > datatable.replaceWith(replacement);
> > showMineSpan.setVisible(true);
> > showAllSpan.setVisible(false);
> > target.addComponent(replacement);
> >
> > }
> > };
> > final Link showMineLink =new
> AjaxFallbackLink("trafficreportlistmine")
> > {
> > public void onClick(AjaxRequestTarget
> target) {
> > AjaxFallbackDefaultDataTable
> replacement = new
> > AjaxFallbackDefaultDataTable("trafficreportlistdatatable", columns, new
> > ReportListProvider("Traffic", "mine"), 8);
> >
> //this.replaceWith(replacement);
> >
> replacement.setOutputMarkupId(true);
> > datatable.replaceWith(replacement);
> > showMineSpan.setVisible(true);
> > showAllSpan.setVisible(false);
> > target.addComponent(replacement);
> > }
> > };
> >
> > showAllSpan.setVisible(true);
> > showMineSpan.setVisible(false);
> > showMineSpan.add(showMineLink);
> > showAllSpan.add(showAllLink);
> > add(showMineSpan);
> > add(showAllSpan);
> >
> > }
> >
> >
> >
> > }
> >
> > <wicket:panel>
> > <h2>Recent Reports</h2> # Show All
> > # Show Mine
> > <table wicket:id="trafficreportlistdatatable" class="dataview"
> > cellspacing="0"></table>
> > </wicket:panel>
> >
> >
> >
> >
> >
> > marius1maru wrote:
> >>
> >> Hello,
> >> I'm using a ListView of links limited to only 5 links, an
> >> AjaxFallbackLink (showMore) that will remove the limitation, and another
> >> AjaxFallbackLink
> >> (showLess) that will enable the limitation.
> >> Works fine on every browser except IE6. On IE6, after the user presses
> >> showMore link, the list will expand, but the links are frosen(I can see
> >> them, but
> >> can not click on them).
> >> The code looks like this:
> >>
> >> in html:
> >>
> >>
> >> <p> # </p>
> >>
> >>
> >> <p>
> >> #
> >> #
> >> </p>
> >>
> >>
> >> in java:
> >>
> >> final AjaxFallbackLink showLessLink = new AjaxLink("showLessLink")
> >> {
> >> @Override
> >> public void onClick(AjaxRequestTarget target)
> >> {
> >> linksList.setViewSize(5);
> >> showMoreSpan.setVisible(true);
> >> showLessSpan.setVisible(false);
> >> target.addComponent(listContainer);
> >> }
> >> };
> >> showLessLink.add(new Label("showLess", "<<less"));
> >> final AjaxFallbackLink showMoreLink = new AjaxLink("showMoreLink")
> >> {
> >> @Override
> >> public void onClick(AjaxRequestTarget target)
> >> {
> >> linksList.setViewSize(linksList.getList().size());
> >> showMoreSpan.setVisible(false);
> >> showLessSpan.setVisible(true);
> >> target.addComponent(listContainer);
> >> }
> >> };
> >> showMoreLink.add(new Label("showMore", "more>>"));
> >> final WebMarkupContainer showLessSpan = new
> >> WebMarkupContainer("showLessSpan");
> >> showLessSpan.setOutputMarkupId(true);
> >> showLessSpan.setVisible(false);
> >> final WebMarkupContainer showMoreSpan = new
> >> WebMarkupContainer("showMoreSpan");
> >> showLessSpan.setOutputMarkupId(true);
> >> showLessSpan.setVisible(true);
> >> showLessSpan.add(showLessLink);
> >> showMoreSpan.add(showMoreLink);
> >> listContainer.add(showLessSpan);
> >> listContainer.add(showMoreSpan);
> >>
> >> After the first ajax request(by clicking on "showMore" link), the
> >> "showLess" link is displayed, but frozen. The same results is when I'm
> >> using AjaxLink.
> >> I am using wicket 1.4 rc2.
> >> Can please someone help me?
> >>
> >>
> >>
> >>
> >
> >
>
> --
> View this message in context:
> http://www.nabble.com/AjaxFallbackLink-problem-on-Internet-Explorer-6-tp23501338p26018919.html
> Sent from the Wicket - User mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [email protected]
> For additional commands, e-mail: [email protected]
>
>