Search code examples
javawicket

In Wicket DefaultTableTree is it possible to use AJAX page navigation?


We're using a DefaultTableTree which is working great except that I have other content on the page and I would like paging to perform an update of only the table content instead of full page refresh.

I noticed the constructor of DefaultTableTree constructs a NavigationToolBar (non AJAX):

public DefaultTableTree(String id, List<? extends IColumn<T, S>> columns, ISortableTreeProvider<T, S> provider, int rowsPerPage, IModel<Set<T>> state) {
        super(id, columns, provider, (long)rowsPerPage, state);
        this.getTable().addTopToolbar(new NavigationToolbar(this.getTable()));
        this.getTable().addTopToolbar(new HeadersToolbar(this.getTable(), provider));
        this.getTable().addBottomToolbar(new NoRecordsToolbar(this.getTable()));
        this.add(new Behavior[]{new WindowsTheme()});
}

Is there some kind of override of this behaviour to get it to create an AjaxNavigationToolBar instead of this non AJAX version of the navigator?

If not, should it be ok to simply remove that navigator and replace it with the AJAX version after construction of the DefaultTableTree?


Solution

  • DefaultTableTree is just a default implementation of its abstract superclass with some configuration of toolbars and theme:

    https://github.com/apache/wicket/blob/master/wicket-extensions/src/main/java/org/apache/wicket/extensions/markup/html/repeater/tree/DefaultTableTree.java

    It's probably easier for you to directly subclass TableTree and configure it as you need it.