You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by Francisco Saez <fr...@hotmail.com> on 2013/10/04 13:05:32 UTC
PagingNavigator inside repeater
Hi all,
I have a list of elements wich a sub-list of elements for each of them.
For example:
* Category 1
- Element 1.1
- Element 1.2
*Category 2
- Element 2.1
- Elemnt 2.2
I have no problmes when I try to paginate the root list of elements (in the example, categories). But when I try to paginate each sub-list I have some problems. Links appear with correct page number, but nothing happen when I click they.
I've tried with PaginNavigator and also with AjaxPagingNavigartor (with a WebMarkupContainer). Here is the code:
<div wicket:id="categories">
<div wicket:id="cat_title">Category title</div>
<div wicket:id="container">
<table>
<tbody>
<tr wicket:id="achievements">
<td><span wicket:id="name">Test Name</span></td>
</tr>
</tbody>
</table>
<div wicket:id="navigator"></div>
</div>
</div>
<div wicket:id="navigator0"></div>
-----------------
final HashMap<Long, List<Achievement>> achievementsMap = projectLogic.getAchievements();
PageableListView<Category> categoriesListView = new PageableListView<Category>("categories", projectLogic.getCategories(), 5) {
@Override
protected void populateItem(ListItem<Category> item) {
final Category category = (Category) item.getModelObject();
//title
item.add(new Label("cat_title", category.getDescription()));
WebMarkupContainer wmc = new WebMarkupContainer("container");
item.add(wmc);
//achievements list
PageableListView<Achievement> achievementsListView = new PageableListView<Achievement>("achievements", achievementsMap.get(category.getId()), 5) {
@Override
protected void populateItem(ListItem<Achievement> item) {
final Achievement achievement = (Achievement) item.getModelObject();
Label l = new Label("name", achievement.getDescription());
item.add(l);
}
};
wmc.add(achievementsListView);
//navigator
PagingNavigator pn = new AjaxPagingNavigator("navigator", achievementsListView);
wmc.add(pn);
}
};
add(categoriesListView);
add(new PagingNavigator("navigator0", categoriesListView));
-------------
Any idea of what is happening??
Thanks in advance and regards.
Re: PagingNavigator inside repeater
Posted by frasese <fr...@hotmail.com>.
Tested and working...
Thanks a lot!!!!
--
View this message in context: http://apache-wicket.1842946.n4.nabble.com/PagingNavigator-inside-repeater-tp4661701p4661703.html
Sent from the Users forum mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org
Re: PagingNavigator inside repeater
Posted by Martin Grigorov <mg...@apache.org>.
Hi,
On Fri, Oct 4, 2013 at 1:05 PM, Francisco Saez <fr...@hotmail.com> wrote:
> Hi all,
>
> I have a list of elements wich a sub-list of elements for each of them.
> For example:
> * Category 1
> - Element 1.1
> - Element 1.2
> *Category 2
> - Element 2.1
> - Elemnt 2.2
>
> I have no problmes when I try to paginate the root list of elements (in
> the example, categories). But when I try to paginate each sub-list I have
> some problems. Links appear with correct page number, but nothing happen
> when I click they.
>
> I've tried with PaginNavigator and also with AjaxPagingNavigartor (with a
> WebMarkupContainer). Here is the code:
>
> <div wicket:id="categories">
> <div wicket:id="cat_title">Category title</div>
>
> <div wicket:id="container">
> <table>
> <tbody>
> <tr wicket:id="achievements">
> <td><span wicket:id="name">Test Name</span></td>
> </tr>
> </tbody>
> </table>
>
> <div wicket:id="navigator"></div>
> </div>
> </div>
>
> <div wicket:id="navigator0"></div>
>
> -----------------
>
> final HashMap<Long, List<Achievement>> achievementsMap =
> projectLogic.getAchievements();
>
> PageableListView<Category> categoriesListView = new
> PageableListView<Category>("categories", projectLogic.getCategories(), 5) {
>
> @Override
> protected void populateItem(ListItem<Category> item) {
> final Category category = (Category) item.getModelObject();
>
> //title
> item.add(new Label("cat_title", category.getDescription()));
>
> WebMarkupContainer wmc = new WebMarkupContainer("container");
> item.add(wmc);
>
> //achievements list
> PageableListView<Achievement> achievementsListView = new
> PageableListView<Achievement>("achievements",
> achievementsMap.get(category.getId()), 5) {
>
> @Override
> protected void populateItem(ListItem<Achievement> item) {
> final Achievement achievement = (Achievement)
> item.getModelObject();
>
> Label l = new Label("name", achievement.getDescription());
> item.add(l);
>
> }
> };
> wmc.add(achievementsListView);
>
> //navigator
> PagingNavigator pn = new AjaxPagingNavigator("navigator",
> achievementsListView);
>
See org.apache.wicket.ajax.markup.html.navigation.paging.AjaxPagingNavigator#onAjaxEvent
Repeaters cannot be updated with Ajax and that's why their parent is
repainted.
Just add: wmc.setOutputMarkupId(true)
> wmc.add(pn);
> }
> };
> add(categoriesListView);
>
> add(new PagingNavigator("navigator0", categoriesListView));
>
> -------------
>
> Any idea of what is happening??
>
> Thanks in advance and regards.
>
>