I have a page on which I want to show products. Because I want to also want
to show products on otherpages in the same way, I've made a ProductPanel.
I'm also using ListView to show multiple ProductPanels on each page.
I'm using a panel in a list, but this gives an extra div. I don't see how I
can remove this extra div.
See my code below and the generated html output. As you can see, every
single item in the list, gives this html: <div wicket:id="products"> and
<div wicket:id="product">. I would like to have only 1 div instead of two.
What is the Wicket way to solve this?
==== ProductsPage.html =====
<div wicket:id="products">
<div wicket:id="product"></div>
</div>
==== ProductsPage.java =====
public class ProductsPage extends BasePage {
public ModelsPage() {
List<Product> products = dao.getProducts();
add(new ListView("products", products) {
@Override
protected void populateItem(ListItem item) {
Product product = (Product)
item.getModelObject();
item.add(new ProductPanel("product", product));
}
});
}
}
==== ProductPanel.html =====
<wicket:panel>
</wicket:panel>
==== ProductPanel.java =====
public class ProductPanel extends Panel {
public ProductPanel(String id, Product product) {
super(id);
add(new Label("name", product.getName()));
add(new Label("description", product.getDescription()));
add(new Label("price", product.getPrice()));
}
}
==== Generated HTML Output =====
<div wicket:id="products">
<div wicket:id="product">
<wicket:panel>
aaaa
aaaa
1111
</wicket:panel>
</div>
</div>
<div wicket:id="products">
<div wicket:id="product">
<wicket:panel>
bbbbb
bbbbbb
22222
</wicket:panel>
</div>
</div>
<div wicket:id="products">
<div wicket:id="product">
<wicket:panel>
ccccc
ccccc
33333
</wicket:panel>
</div>
</div>
--
View this message in context:
http://www.nabble.com/Panel-in-List%2C-remove-extra-div-tp21656188p21656188.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]