I reply to myself... I just have found
http://www.nabble.com/Problems-with-clearing-of-filter-form-td16098239.html
I have to include the table in a form with some form specific components
(focus-restore and focus-tracker)
<form wicket:id="filter-form">
<input type="hidden" name="tracker"
wicket:id="focus-tracker"/>
<table wicket:id="datatable"></table>
<span wicket:id="focus-restore">[call to focus
restore
script]</span>
</form>
and here is the java :
final DefaultDataTable table = new DefaultDataTable("datatable",
columns, provider, 30);
final FilterForm form = new FilterForm("filter-form", provider);
table.addTopToolbar(new FilterToolbar(table, form, provider));
form.add(table);
add(form);
Next I have read in FilterToolbar that the filter are found by using
columns with instances of IFilteredColumn like FilteredAbstractColumn...
So I just replace the column declaration :
before :
new PropertyColumn(new Model("author"), "author", "author")
after (with filter)
new TextFilteredPropertyColumn(new Model("author"), "author",
"author");
and hop, the column header change in a texfield! great!
when I enter some text I got an error (Attempted to set property value
on a null object. Property expression: author Value: go) .. but it's
seems better...
Le mercredi 15 avril 2009 à 18:48 +0200, Julien Graglia a écrit :
> Hi,
>
> I try to filter rows of a datatable : I already have sort the rows very
> easily (using a SortableDataProvider) but now I need to filter some
> columns.. which seems to me a rather "classic" task.
>
> I have found classes in
> org.apache.wicket.extensions.markup.html.repeater.data.table.filter like
> ChoiceFilter and IFilterStateLocator but I did not find any examples. It
> seems to me that is what I need but I dont figure out how to use it
>
> I only found a post with a very short code like :
> final DefaultDataTable table = new DefaultDataTable("datatable",
> columns, provider, 30);
> final FilterForm form = new FilterForm("filter-form", provider);
> table.addTopToolbar(new FilterToolbar(table, form, provider));
> form.add(table);
> form.add(new GoAndClearFilter("filter-buttons", form));
> add(form);
>
> but I dont know what html comes with that and how to implements the
> filter.
>
> I have google that the "phonebook" application is using filter but I
> can't get it.
>
> I have to say that I dont know how to start with only the javadoc (how
> to write html? simple example?)
>
> I you have a piece of code of how to use filter and
> IFilterStateLocator...
>
> thx,
--
Julien Graglia
NetCeler
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]