diff --git a/packages/pluggableWidgets/combobox-web/src/Combobox.editorConfig.ts b/packages/pluggableWidgets/combobox-web/src/Combobox.editorConfig.ts index 392b732415..ae46866a6d 100644 --- a/packages/pluggableWidgets/combobox-web/src/Combobox.editorConfig.ts +++ b/packages/pluggableWidgets/combobox-web/src/Combobox.editorConfig.ts @@ -107,7 +107,6 @@ export function getProperties( "selectionMethod", "selectAllButton", "selectAllButtonCaption", - "onChangeEvent", ...ASSOCIATION_SOURCE_CONFIG ]); if (values.optionsSourceDatabaseDataSource === null) { @@ -140,8 +139,18 @@ export function getProperties( if (values.customEditability !== "conditionally") { hidePropertiesIn(defaultProperties, values, ["customEditabilityExpression"]); } + + // hide generic On change event when value is not saved anywhere. + // Users should use On change that is assigned to the selection API (onChangeDatabaseEvent) + hidePropertiesIn(defaultProperties, values, ["onChangeEvent"]); } else { hidePropertiesIn(defaultProperties, values, ["customEditability", "customEditabilityExpression"]); + + // hide On change event that is tied to the selection API (onChangeDatabaseEvent) + // this event runs on initialization even though the actual value set to + // Target (databaseAttributeString) is not changing and this is confusing. + // Users should use generic On change event + hidePropertiesIn(defaultProperties, values, ["onChangeDatabaseEvent"]); } } else if (values.source === "static") { hidePropertiesIn(defaultProperties, values, [ diff --git a/packages/pluggableWidgets/combobox-web/src/Combobox.xml b/packages/pluggableWidgets/combobox-web/src/Combobox.xml index 274e3ba9af..083a451eda 100644 --- a/packages/pluggableWidgets/combobox-web/src/Combobox.xml +++ b/packages/pluggableWidgets/combobox-web/src/Combobox.xml @@ -104,8 +104,8 @@ - - Value + + Target @@ -114,8 +114,8 @@ - - Target attribute + + Value @@ -314,10 +314,12 @@ + On change + On change diff --git a/packages/pluggableWidgets/combobox-web/src/helpers/Database/DatabaseSingleSelectionSelector.ts b/packages/pluggableWidgets/combobox-web/src/helpers/Database/DatabaseSingleSelectionSelector.ts index 55944a48fe..a9f27e5258 100644 --- a/packages/pluggableWidgets/combobox-web/src/helpers/Database/DatabaseSingleSelectionSelector.ts +++ b/packages/pluggableWidgets/combobox-web/src/helpers/Database/DatabaseSingleSelectionSelector.ts @@ -1,4 +1,4 @@ -import { EditableValue, ListAttributeValue, ObjectItem, SelectionSingleValue } from "mendix"; +import { ActionValue, EditableValue, ListAttributeValue, ObjectItem, SelectionSingleValue } from "mendix"; import { ComboboxContainerProps, LoadingTypeEnum, @@ -11,6 +11,7 @@ import { DatabaseCaptionsProvider } from "./DatabaseCaptionsProvider"; import { DatabaseOptionsProvider } from "./DatabaseOptionsProvider"; import { DatabaseValuesProvider } from "./DatabaseValuesProvider"; import { extractDatabaseProps, getReadonly } from "./utils"; +import { executeAction } from "@mendix/widget-plugin-platform/framework/execute-action"; export class DatabaseSingleSelectionSelector> implements SingleSelector @@ -30,6 +31,7 @@ export class DatabaseSingleSelectionSelector | undefined; filterInputDebounceInterval: number; + onChangeEvent: ActionValue | undefined; }; export function extractDatabaseProps(props: ComboboxContainerProps): ExtractionReturnValue { @@ -72,6 +74,8 @@ export function extractDatabaseProps(props: ComboboxContainerProps): ExtractionR } } + const onChangeEvent = props.onChangeEvent; + return { targetAttribute, captionProvider: captionType === "attribute" ? captionAttribute : captionExpression, @@ -85,7 +89,8 @@ export function extractDatabaseProps(props: ComboboxContainerProps): ExtractionR lazyLoading, loadingType, valueSourceAttribute, - filterInputDebounceInterval + filterInputDebounceInterval, + onChangeEvent }; } diff --git a/packages/pluggableWidgets/combobox-web/typings/ComboboxProps.d.ts b/packages/pluggableWidgets/combobox-web/typings/ComboboxProps.d.ts index fcc265d859..71cc2e9d1a 100644 --- a/packages/pluggableWidgets/combobox-web/typings/ComboboxProps.d.ts +++ b/packages/pluggableWidgets/combobox-web/typings/ComboboxProps.d.ts @@ -63,8 +63,8 @@ export interface ComboboxContainerProps { optionsSourceDatabaseCaptionAttribute?: ListAttributeValue; optionsSourceAssociationCaptionExpression?: ListExpressionValue; optionsSourceDatabaseCaptionExpression?: ListExpressionValue; - optionsSourceDatabaseValueAttribute?: ListAttributeValue; databaseAttributeString?: EditableValue; + optionsSourceDatabaseValueAttribute?: ListAttributeValue; attributeAssociation: ReferenceValue | ReferenceSetValue; optionsSourceAssociationDataSource?: ListValue; staticAttribute: EditableValue; @@ -120,8 +120,8 @@ export interface ComboboxPreviewProps { optionsSourceDatabaseCaptionAttribute: string; optionsSourceAssociationCaptionExpression: string; optionsSourceDatabaseCaptionExpression: string; - optionsSourceDatabaseValueAttribute: string; databaseAttributeString: string; + optionsSourceDatabaseValueAttribute: string; attributeAssociation: string; optionsSourceAssociationDataSource: {} | { caption: string } | { type: string } | null; staticAttribute: string;