Hi,

On Fri, Oct 4, 2013 at 1:05 PM, Francisco Saez <[email protected]> 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.
>
>

Reply via email to