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

@ -1224,44 +1224,44 @@ public class FindWindow extends Window implements EventListener<Event>, ValueCha
{
cellQueryFrom.setAttribute("value", value); // Elaine 2009/03/16 - set attribute value
//Attribute Values Parsing
if(tableName.equals(MAttribute.COLUMNNAME_M_Attribute_ID))
{
cellQueryFrom.appendChild(parseAttributeString( Integer.valueOf(columnName), value, listItem, false));
}
else
{
editorFrom = parseString(getTargetMField(columnName), value, listItem, false);
if (editorFrom != null)
cellQueryFrom.appendChild(editorFrom.getComponent());
}
if(tableName.equals(MAttribute.COLUMNNAME_M_Attribute_ID))
{
cellQueryFrom.appendChild(parseAttributeString( Integer.valueOf(columnName), value, listItem, false));
}
else
{
editorFrom = parseString(getTargetMField(columnName), value, listItem, false);
if (editorFrom != null)
cellQueryFrom.appendChild(editorFrom.getComponent());
}
}
// QueryTo
WEditor editorTo = null;
WEditor editorTo = null;
String value2 = fields.length > INDEX_VALUE2 ? fields[INDEX_VALUE2] : "";
if(value2.length() > 0)
{
cellQueryTo.setAttribute("value", value2); // Elaine 2009/03/16 - set attribute value
// Attribute Parsing
if(tableName.equals(MAttribute.COLUMNNAME_M_Attribute_ID))
{
{
cellQueryTo.appendChild(parseAttributeString( Integer.valueOf(columnName), value2, listItem, true));
}
}
else
{
editorTo = parseString(getTargetMField(columnName), value2, listItem, true);
if (editorTo != null)
{
if (editorFrom != null && editorFrom.getGridField() != null && DisplayType.isDate(editorFrom.getGridField().getDisplayType()))
editorTo = parseString(getTargetMField(columnName), value2, listItem, true);
if (editorTo != null)
{
Div div = createDateRangeWrapper(editorFrom, editorTo);
cellQueryTo.appendChild(div);
}
else
{
cellQueryTo.appendChild(editorTo.getComponent());
if (editorFrom != null && editorFrom.getGridField() != null && DisplayType.isDate(editorFrom.getGridField().getDisplayType()))
{
Div div = createDateRangeWrapper(editorFrom, editorTo);
cellQueryTo.appendChild(div);
}
else
{
cellQueryTo.appendChild(editorTo.getComponent());
}
}
}
}
}
// AndOr
@ -1593,18 +1593,24 @@ public class FindWindow extends Window implements EventListener<Event>, ValueCha
m_sEditorsFlag.add(editorFlag);
editorFlag.setMode("toggle");
div.appendChild(editorFlag);
div.appendChild(fieldEditorTo);
DateRangeButton drb = new DateRangeButton(editor, editorTo);
div.appendChild(drb);
fieldEditorTo.setVisible(false);
drb.setVisible(false);
div.appendChild(fieldEditorTo);
DateRangeButton drb = null;
if (editor.getGridField() != null && DisplayType.isDate(editor.getGridField().getDisplayType()))
{
drb = new DateRangeButton(editor, editorTo);
div.appendChild(drb);
drb.setVisible(false);
}
fieldEditorTo.setVisible(false);
final Component editorRef = fieldEditorTo;
final DateRangeButton drbRef = drb;
editorFlag.addEventListener(Events.ON_CHECK, new EventListener<Event>() {
@Override
public void onEvent(Event event) throws Exception {
ToolBarButton btn = (ToolBarButton) event.getTarget();
editorRef.setVisible(btn.isChecked());
drb.setVisible(editorRef.isVisible());
if (drbRef != null)
drbRef.setVisible(editorRef.isVisible());
}
});
m_sEditorsTo.add(editorTo);