IDEMPIERE-5443 Date Range Filter Component (#1551)

- Fix issue with non-date field
This commit is contained in:
hengsin 2022-11-08 20:34:16 +08:00 committed by GitHub
parent 193141324e
commit c926c05d4e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 36 additions and 30 deletions

View File

@ -1594,17 +1594,23 @@ public class FindWindow extends Window implements EventListener<Event>, ValueCha
editorFlag.setMode("toggle"); editorFlag.setMode("toggle");
div.appendChild(editorFlag); div.appendChild(editorFlag);
div.appendChild(fieldEditorTo); div.appendChild(fieldEditorTo);
DateRangeButton drb = new DateRangeButton(editor, editorTo); DateRangeButton drb = null;
if (editor.getGridField() != null && DisplayType.isDate(editor.getGridField().getDisplayType()))
{
drb = new DateRangeButton(editor, editorTo);
div.appendChild(drb); div.appendChild(drb);
fieldEditorTo.setVisible(false);
drb.setVisible(false); drb.setVisible(false);
}
fieldEditorTo.setVisible(false);
final Component editorRef = fieldEditorTo; final Component editorRef = fieldEditorTo;
final DateRangeButton drbRef = drb;
editorFlag.addEventListener(Events.ON_CHECK, new EventListener<Event>() { editorFlag.addEventListener(Events.ON_CHECK, new EventListener<Event>() {
@Override @Override
public void onEvent(Event event) throws Exception { public void onEvent(Event event) throws Exception {
ToolBarButton btn = (ToolBarButton) event.getTarget(); ToolBarButton btn = (ToolBarButton) event.getTarget();
editorRef.setVisible(btn.isChecked()); editorRef.setVisible(btn.isChecked());
drb.setVisible(editorRef.isVisible()); if (drbRef != null)
drbRef.setVisible(editorRef.isVisible());
} }
}); });
m_sEditorsTo.add(editorTo); m_sEditorsTo.add(editorTo);