Skip to content
Snippets Groups Projects
Commit 5000839a authored by buczekp's avatar buczekp
Browse files

[LMS-1518] fixed problem with combo box selectionChanged event not being fired...

[LMS-1518] fixed problem with combo box selectionChanged event not being fired after reset of filters

SVN: 16227
parent 6e0192a7
No related branches found
No related tags found
No related merge requests found
...@@ -63,6 +63,8 @@ public class ListColumnFilterWidget<T> extends ComboBox<ModelData> implements ...@@ -63,6 +63,8 @@ public class ListColumnFilterWidget<T> extends ComboBox<ModelData> implements
private final DelayedTask delayedFilterApplierTask; private final DelayedTask delayedFilterApplierTask;
private boolean disableApply = false;
public ListColumnFilterWidget(IColumnDefinition<T> filteredField, public ListColumnFilterWidget(IColumnDefinition<T> filteredField,
final IDelegatedAction onFilterAction, List<String> distinctValues) final IDelegatedAction onFilterAction, List<String> distinctValues)
{ {
...@@ -76,7 +78,10 @@ public class ListColumnFilterWidget<T> extends ComboBox<ModelData> implements ...@@ -76,7 +78,10 @@ public class ListColumnFilterWidget<T> extends ComboBox<ModelData> implements
@Override @Override
public void selectionChanged(SelectionChangedEvent<ModelData> event) public void selectionChanged(SelectionChangedEvent<ModelData> event)
{ {
onFilterAction.execute(); if (disableApply == false)
{
onFilterAction.execute();
}
} }
}); });
...@@ -89,7 +94,7 @@ public class ListColumnFilterWidget<T> extends ComboBox<ModelData> implements ...@@ -89,7 +94,7 @@ public class ListColumnFilterWidget<T> extends ComboBox<ModelData> implements
setToolTip(label); setToolTip(label);
setTemplate(GWTUtils.getTooltipTemplate(MODEL_DISPLAY_KEY, ModelDataPropertyNames.TOOLTIP)); setTemplate(GWTUtils.getTooltipTemplate(MODEL_DISPLAY_KEY, ModelDataPropertyNames.TOOLTIP));
GWTUtils.setupAutoWidth(this); GWTUtils.setupAutoWidth(this);
} }
private static DelayedTask createFilterApplierTask(final IDelegatedAction onFilterAction) private static DelayedTask createFilterApplierTask(final IDelegatedAction onFilterAction)
...@@ -210,10 +215,11 @@ public class ListColumnFilterWidget<T> extends ComboBox<ModelData> implements ...@@ -210,10 +215,11 @@ public class ListColumnFilterWidget<T> extends ComboBox<ModelData> implements
@Override @Override
public void reset() public void reset()
{ {
// Simple 'f.reset()' causes automatic filter application, // 'super.reset()' causes automatic filter application,
// but we want to reload data only once after all filters are cleared. // but we want to reload data only once after all filters are cleared
setRawValue(getEmptyText()); disableApply = true;
applyEmptyText(); super.reset();
disableApply = false;
} }
} }
...@@ -40,6 +40,8 @@ public class TextColumnFilterWidget<T/* entity */> extends StoreFilterField<Mode ...@@ -40,6 +40,8 @@ public class TextColumnFilterWidget<T/* entity */> extends StoreFilterField<Mode
private final IDelegatedAction onFilterAction; private final IDelegatedAction onFilterAction;
private boolean disableApply = false;
/** @param onFilterAction callback executed when data are about to be filtered. */ /** @param onFilterAction callback executed when data are about to be filtered. */
public TextColumnFilterWidget(IColumnDefinition<T> filteredField, public TextColumnFilterWidget(IColumnDefinition<T> filteredField,
IDelegatedAction onFilterAction) IDelegatedAction onFilterAction)
...@@ -71,8 +73,11 @@ public class TextColumnFilterWidget<T/* entity */> extends StoreFilterField<Mode ...@@ -71,8 +73,11 @@ public class TextColumnFilterWidget<T/* entity */> extends StoreFilterField<Mode
@Override @Override
protected void onFilter() protected void onFilter()
{ {
super.onFilter(); if (disableApply == false)
onFilterAction.execute(); {
super.onFilter();
onFilterAction.execute();
}
} }
/** NOTE: We do not use this method, data are filtered on the server side */ /** NOTE: We do not use this method, data are filtered on the server side */
...@@ -103,9 +108,10 @@ public class TextColumnFilterWidget<T/* entity */> extends StoreFilterField<Mode ...@@ -103,9 +108,10 @@ public class TextColumnFilterWidget<T/* entity */> extends StoreFilterField<Mode
@Override @Override
public void reset() public void reset()
{ {
// Simple 'f.reset()' causes automatic filter application, // 'super.reset()' causes automatic filter application,
// but we want to reload data only once after all filters are cleared. // but we want to reload data only once after all filters are cleared
setRawValue(getEmptyText()); disableApply = true;
applyEmptyText(); super.reset();
disableApply = false;
} }
} }
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment