Skip to content

Commit

Permalink
Fixes #435
Browse files Browse the repository at this point in the history
  • Loading branch information
nmandrescu committed Mar 14, 2022
1 parent 7288237 commit 913b4ee
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 4 deletions.
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
package org.devgateway.toolkit.forms.wicket.components.table;

import org.apache.wicket.AttributeModifier;
import org.apache.wicket.Component;
import org.apache.wicket.ajax.AjaxRequestTarget;
import org.apache.wicket.ajax.form.AjaxFormComponentUpdatingBehavior;
import org.apache.wicket.extensions.markup.html.repeater.data.table.filter.FilterForm;
import org.apache.wicket.extensions.markup.html.repeater.data.table.filter.TextFilteredPropertyColumn;
import org.apache.wicket.model.IModel;
Expand Down Expand Up @@ -32,7 +33,12 @@ public Component getFilter(final String componentId, final FilterForm<?> form) {
final DateFieldBootstrapFormComponent dateField =
new DateFieldBootstrapFormComponent(componentId, getFilterModel(form));
dateField.hideLabel();
dateField.getField().add(AttributeModifier.replace("onchange", "this.form.submit();"));
dateField.getField().add(new AjaxFormComponentUpdatingBehavior("change") {
@Override
protected void onUpdate(final AjaxRequestTarget target) {
target.add(form);
}
});
return dateField;
}
}
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
package org.devgateway.toolkit.forms.wicket.components.table;

import org.apache.wicket.AttributeModifier;
import org.apache.wicket.Component;
import org.apache.wicket.ajax.AjaxRequestTarget;
import org.apache.wicket.ajax.form.AjaxFormComponentUpdatingBehavior;
import org.apache.wicket.extensions.markup.html.repeater.data.table.filter.FilterForm;
import org.apache.wicket.extensions.markup.html.repeater.data.table.filter.TextFilteredPropertyColumn;
import org.apache.wicket.model.IModel;
Expand All @@ -28,7 +29,12 @@ public Component getFilter(final String componentId, final FilterForm<?> form) {
final LocalDateFieldBootstrapFormComponent dateField =
new LocalDateFieldBootstrapFormComponent(componentId, getFilterModel(form));
dateField.hideLabel();
dateField.getField().add(AttributeModifier.replace("onchange", "this.form.submit();"));
dateField.getField().add(new AjaxFormComponentUpdatingBehavior("change") {
@Override
protected void onUpdate(final AjaxRequestTarget target) {
target.add(form);
}
});
return dateField;
}
}
Expand Down

0 comments on commit 913b4ee

Please sign in to comment.