You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by Benedikt Schlegel <co...@gmail.com> on 2010/09/15 14:42:19 UTC
DataTable: focus-tracker fails
Hi folks,
is there anything i need to consider while setting up an DataTable with
FilterToolbar?
I have a FilterForm, added those 2 required hidden fields and everything
looks fine so far. But when i use the filter, the script fails setting the
focus on the 'active' field. I get a JS error
"document.getElementById(focused).focus() is null" but i dont know how to
fix that. Seems like the field does not exist at executing time.
Anyone else facing that problem? Anyone solved it?
So long,
Benedikt
Re: DataTable: focus-tracker fails
Posted by Benedikt Schlegel <co...@gmail.com>.
Solved it by extending FilterForm:
public class FilterForm extends
org.apache.wicket.extensions.markup.html.repeater.data.table.filter.FilterForm
{
private static final long serialVersionUID = 1L;
public FilterForm(String id, IFilterStateLocator locator) {
super(id, locator);
super.remove("focus-restore");
add(new AbstractBehavior() {
private static final long serialVersionUID = 1L;
@Override
public void renderHead(IHeaderResponse response) {
super.renderHead(response);
response.renderOnDomReadyJavascript("_filter_focus_restore('"
+getFocusTrackerFieldCssId()+ "');");
}
});
}
}
Solution has been found in the wicket-users archives.