diff --git a/packages/pluggableWidgets/combobox-web/CHANGELOG.md b/packages/pluggableWidgets/combobox-web/CHANGELOG.md index 4508ffb96e..2a2e1e7cb9 100644 --- a/packages/pluggableWidgets/combobox-web/CHANGELOG.md +++ b/packages/pluggableWidgets/combobox-web/CHANGELOG.md @@ -6,6 +6,14 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), ## [Unreleased] +### Added + +- We introduced a new "On change" action in Database mode that fires only when the selection changes, unlike the previous behavior that fired on initialization. + +### Changed + +- We renamed the "On change" action in Database mode to "On selection" to better describe its actual behavior (fires on initialization and selection changes). + ## [2.7.2] - 2026-01-28 ### Fixed diff --git a/packages/pluggableWidgets/combobox-web/src/Combobox.editorConfig.ts b/packages/pluggableWidgets/combobox-web/src/Combobox.editorConfig.ts index 392b732415..0bf88749e7 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,6 +139,10 @@ 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 selection" that is assigned to the selection API (onChangeDatabaseEvent) + hidePropertiesIn(defaultProperties, values, ["onChangeEvent"]); } else { hidePropertiesIn(defaultProperties, values, ["customEditability", "customEditabilityExpression"]); } diff --git a/packages/pluggableWidgets/combobox-web/src/Combobox.xml b/packages/pluggableWidgets/combobox-web/src/Combobox.xml index 274e3ba9af..32e6d4261a 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,12 +314,14 @@ + On change - On change - + + On selection + This event happens when "selection of" this widget changes or initializes. On enter 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;