Robin Shine wrote:
Hi All,
It seems that the navigation toolbar of data table component can not be 
displayed if there is a link on the page surrounded with the wicket:enclosure 
tag. Here is my very simple test case:

TestPage.html:

<html xmlns="http://www.w3.org/1999/xhtml";>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
</head>
<body>
<wicket:enclosure><a wicket:id="link">link</a></wicket:enclosure>
<table wicket:id="data"></table>
</body>
</html>

TestPage.java:

package test;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;

import 
org.apache.wicket.extensions.markup.html.repeater.data.table.AbstractColumn;
import org.apache.wicket.extensions.markup.html.repeater.data.table.DataTable;
import 
org.apache.wicket.extensions.markup.html.repeater.data.table.NavigationToolbar;
import org.apache.wicket.markup.html.WebPage;
import org.apache.wicket.markup.html.basic.Label;
import org.apache.wicket.markup.html.link.Link;
import org.apache.wicket.markup.repeater.Item;
import org.apache.wicket.markup.repeater.data.IDataProvider;
import org.apache.wicket.model.IModel;
import org.apache.wicket.model.Model;

public class TestPage extends WebPage { public TestPage() {
add(new Link("link") {
@Override
public void onClick() {
} @Override
public boolean isVisible() {
return false;
}
});
AbstractColumn[] columns = new AbstractColumn[]{
new AbstractColumn(new Model("value")) {
public void populateItem(Item cellItem, String componentId, IModel rowModel) {
cellItem.add(new Label(componentId, rowModel.getObject().toString()));
} },
};
IDataProvider dataProvider = new IDataProvider() {
public Iterator iterator(int first, int count) {
List<String> values = new ArrayList<String>();
for (int i=0; i<count; i++)
values.add(String.valueOf(i + first));
return values.iterator();
}
public int size() {
return 100;
}
public IModel model(Object object) {
return new Model((Serializable) object);
}
public void detach() {
}
};
DataTable dataTable = new DataTable("data", columns, dataProvider, 10);
dataTable.addBottomToolbar(new NavigationToolbar(dataTable));
add(dataTable);
}
}

Add this page to a wicket application, then mount and navigate to the page:
The navigation toolbar of the data table is not displayed. However if the "wicket:enclosure" tag is removed from the template, the toobar then displays correctly.
Is this a bug? Or is there anything obvious I missed?

I stumbled upon exactly the same poblem. The only thing I can tell you: you don't need wicket:enclosure in your case. Simply remove the tag and as Link.isVisible returns false it will not be rendered.

If you put anything else apart from <link/> into wicket:enclosure you should see correct behavior.

This probably IS a bug. File a JIRA request for that.

--
Leszek Gawron

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

Reply via email to