diff --git a/src/qqq/components/forms/DynamicSelect.tsx b/src/qqq/components/forms/DynamicSelect.tsx index 6c40a0e..ccaeb92 100644 --- a/src/qqq/components/forms/DynamicSelect.tsx +++ b/src/qqq/components/forms/DynamicSelect.tsx @@ -51,6 +51,7 @@ interface Props bulkEditSwitchChangeHandler?: any; otherValues?: Map; variant: "standard" | "outlined"; + initiallyOpen: boolean; } DynamicSelect.defaultProps = { @@ -66,6 +67,7 @@ DynamicSelect.defaultProps = { bulkEditMode: false, otherValues: new Map(), variant: "outlined", + initiallyOpen: false, bulkEditSwitchChangeHandler: () => { }, @@ -73,12 +75,13 @@ DynamicSelect.defaultProps = { const qController = Client.getInstance(); -function DynamicSelect({tableName, processName, fieldName, overrideId, fieldLabel, inForm, initialValue, initialDisplayValue, initialValues, onChange, isEditable, isMultiple, bulkEditMode, bulkEditSwitchChangeHandler, otherValues, variant}: Props) +function DynamicSelect({tableName, processName, fieldName, overrideId, fieldLabel, inForm, initialValue, initialDisplayValue, initialValues, onChange, isEditable, isMultiple, bulkEditMode, bulkEditSwitchChangeHandler, otherValues, variant, initiallyOpen}: Props) { - const [open, setOpen] = useState(false); + const [open, setOpen] = useState(initiallyOpen); const [options, setOptions] = useState([]); const [searchTerm, setSearchTerm] = useState(null); const [firstRender, setFirstRender] = useState(true); + const [otherValuesWhenResultsWereLoaded, setOtherValuesWhenResultsWereLoaded] = useState(JSON.stringify(Object.fromEntries((otherValues)))) const {inputBorderColor} = colors; //////////////////////////////////////////////////////////////////////////////////////////////// @@ -113,7 +116,14 @@ function DynamicSelect({tableName, processName, fieldName, overrideId, fieldLabe { // console.log("First render, so not searching..."); setFirstRender(false); - return; + + /* + if(!initiallyOpen) + { + console.log("returning because not initially open?"); + return; + } + */ } // console.log("Use effect for searchTerm - searching!"); @@ -146,6 +156,24 @@ function DynamicSelect({tableName, processName, fieldName, overrideId, fieldLabe }; }, [ searchTerm ]); + // todo - finish... call it in onOpen? + const reloadIfOtherValuesAreChanged = () => + { + if(JSON.stringify(Object.fromEntries(otherValues)) != otherValuesWhenResultsWereLoaded) + { + (async () => + { + setLoading(true); + setOptions([]); + console.log("Refreshing possible values..."); + const results: QPossibleValue[] = await qController.possibleValues(tableName, processName, fieldName, searchTerm ?? "", null, otherValues); + setLoading(false); + setOptions([ ...results ]); + setOtherValuesWhenResultsWereLoaded(JSON.stringify(Object.fromEntries(otherValues))); + })(); + } + } + const inputChanged = (event: React.SyntheticEvent, value: string, reason: string) => { // console.log(`input changed. Reason: ${reason}, setting search term to ${value}`); diff --git a/src/qqq/components/query/QuickFilter.tsx b/src/qqq/components/query/QuickFilter.tsx index 4a08f1b..1580b6b 100644 --- a/src/qqq/components/query/QuickFilter.tsx +++ b/src/qqq/components/query/QuickFilter.tsx @@ -291,7 +291,7 @@ export default function QuickFilter({tableMetaData, fullFieldName, fieldMetaData let startIcon = {startIconName} if(criteriaIsValid) { - startIcon = {startIcon} + startIcon = {startIcon} } let buttonContent = {tableForField?.name != tableMetaData.name ? `${tableForField.label}: ` : ""}{fieldMetaData.label} diff --git a/src/qqq/pages/records/query/RecordQuery.tsx b/src/qqq/pages/records/query/RecordQuery.tsx index 7044b32..b79d5b3 100644 --- a/src/qqq/pages/records/query/RecordQuery.tsx +++ b/src/qqq/pages/records/query/RecordQuery.tsx @@ -2153,10 +2153,14 @@ function RecordQuery({table, launchProcess}: Props): JSX.Element - Fields that are frequently used for filter conditions can be added here for quick access.

- Use the add_circle_outline button to add a field.

- To remove a field, click it and then use the highlight_off button. + + Fields that you frequently use for filter conditions can be added here for quick access.

+ Use the + add_circle_outline + button to add a Quick Filter field.

+ To remove a Quick Filter field, click the field name, and then use the + highlight_off + button.
} placement="left"> Quick Filter: