File

src/ui/combo-editor/smart-combo-editor.component.ts

Extends

AbstractSmartViewerFieldComponent

Implements

OnInit DoCheck OnDestroy

Metadata

Index

Properties
Methods
Inputs
Outputs
Accessors

Constructor

constructor(serviceAdapter: SmartServiceAdapter, elementRef: ElementRef, dsRegistry: DataSourceRegistry, errorHandler: SmartErrorHandlerService, widgetFacadeFactory: WidgetFacadeFactory, changeDetector: ChangeDetectorRef, formInstanceService: SmartFormInstanceService, viewerHelper: SmartViewerHelperService<AbstractFrameComponent>, inputDirective: InputFacadeDirective)
Parameters :
Name Type Optional
serviceAdapter SmartServiceAdapter No
elementRef ElementRef No
dsRegistry DataSourceRegistry No
errorHandler SmartErrorHandlerService No
widgetFacadeFactory WidgetFacadeFactory No
changeDetector ChangeDetectorRef No
formInstanceService SmartFormInstanceService No
viewerHelper SmartViewerHelperService<AbstractFrameComponent> No
inputDirective InputFacadeDirective No

Inputs

autoCompleteMode
Type : string

Sets the autocomplete mode.

autoSuggestFilterMode
Type : string

Sets the autosuggest filter mode.

display-column-name
Type : string

Sets the field which should be used to display the combo editor's value

display-fields
Type : string

Sets the fields that will be used to render the Combo Editor's item template

display-substitute
Type : string

Sets the pattern that will be used to render the Combo Editor's item template Example: [Field1] - [Field2]

enabled
Type : boolean

Sets whether the component is enabled

id
Type : string

The component ID.

image-field-name
Type : string

Sets the image field name

image-substitute
Type : string

Sets the image substitute pattern

key-column-name
Type : string

Sets the key field by which the combo editor should filter its data source

provide-foreign-field-value
Type : void | string

Sets the provider for foreign field values.

selected
Type : any

Sets the selected record

smart-business-entity-name
Type : string

Sets the business entity name

smart-combo-allow-filter
Type : boolean

Sets whether filtering (ComboBox) is enabled

smart-data-source
Type : string

Sets the parent data source name

smart-entity-table
Type : string

Sets the entity table name

smart-entity-view
Type : string

Sets the entity view name

smart-field-binding
Type : any

Sets the field binding expression.

smart-filter
Type : any

Sets the filter expression

smart-flag-image
Type : string

Sets the flag image URL.

smart-flag-label
Type : string

Sets the flag label.

smart-flag-value
Type : string

Sets the flag value.

smart-foreign-fields
Type : string

Sets the foreign fields for query string filtering

smart-help-url
Type : string

Sets the help URL for the component

smart-limit-to-list
Type : boolean

Sets whether entries are limited to predefined list values

smart-partial-dataset
Type : boolean

Deprecated no-op. Partial dataset handling is derived from the JSDO table reference root-table metadata.

smart-query-string
Type : string

Sets the query string for filtering

smart-sort
Type : any

Sets the sort expression

smart-value-list
Type : string

The SmartValueList that this combo editor should bind to.

smart-value-list-display-text
Type : ValueListDisplayText

Sets the display text mode for value lists.

smartModel
Type : any

Sets the ngModel value and updates the combo when dropdown list is ready

style
Type : any

Sets the component style

value-list
Type : [] | null

The value list array.

value-list-entries
Type : [] | null

Repository value list entries.

value-list-pair
Type : [] | null

The value list pair array.

editorButtons
Type : EditorButton[]
Default value : []
smart-viewer-unbound-field
Type : boolean
smart-instance-name
Type : string

The instance name of the component

smart-object-name
Type : string

The object name of the component

Outputs

blur
Type : EventEmitter<void>
focus
Type : EventEmitter<void>
smartModelChange
Type : EventEmitter<string>
onEditorButtonClicked
Type : EditorButton

Methods

callNativeMethod
callNativeMethod(methodName: string, args: any[])

Calls a native method on the combo input element

Parameters :
Name Type Optional Description
methodName string No
  • The method name to call
args any[] No
  • The arguments to pass to the method
Returns : any

The result of the method call

clear
clear()

Clears the combo editor value

Returns : void
Public getImageUrl
getImageUrl(key: string)

Gets the image URL for the given key

Parameters :
Name Type Optional Description
key string No
  • The image key
Returns : string

The resolved image URL

getNativeProperty
getNativeProperty(propertyName: string)

Gets a native property from the combo input element

Parameters :
Name Type Optional Description
propertyName string No
  • The property name to get
Returns : any

The property value

Public onBlur
onBlur()

Handles blur events on the combo editor

Returns : void
Public onComboSelectionChange
onComboSelectionChange(value: unknown)

Handles combo selection change events

Parameters :
Name Type Optional Description
value unknown No
  • The selected value
Returns : void
setNativeProperty
setNativeProperty(propertyName: string, value: any)

Sets a native property on the combo input element

Parameters :
Name Type Optional Description
propertyName string No
  • The property name to set
value any No
  • The value to set
Returns : void
setQueryStringFilter
setQueryStringFilter()

Sets the query string filter and triggers data refresh if needed

Returns : void
Public updateSelectedItem
updateSelectedItem(value: any)

Updates only the selected item without fetching data

Parameters :
Name Type Optional Description
value any No
  • The value to set as selected
Returns : void

Properties

Readonly autoCompleteModeSignal
Type : Signal<string>
Default value : this._autoCompleteModeSignal.asReadonly()
Readonly autoSuggestFilterModeSignal
Type : Signal<string>
Default value : this._autoSuggestFilterModeSignal.asReadonly()
comboNgModel
Type : NgModel
Decorators :
@ViewChild('comboModelDirective')
dataSourceId
Type : string
Readonly fieldBindingSignal
Type : Signal<any>
Default value : this._fieldBindingSignal.asReadonly()
Readonly flagImageSignal
Type : Signal<string>
Default value : this._flagImageSignal.asReadonly()
Readonly flagLabelSignal
Type : Signal<string>
Default value : this._flagLabelSignal.asReadonly()
Readonly flagValueSignal
Type : Signal<string>
Default value : this._flagValueSignal.asReadonly()
Readonly idSignal
Type : Signal<string>
Default value : this._id.asReadonly()

Readonly signal exposing the component ID.

previousSelection
Type : ComboOption
Readonly provideForeignFieldValueSignal
Type : Signal<void | string>
Default value : this._provideForeignFieldValueSignal.asReadonly()
Readonly valueListDisplayTextSignal
Type : Signal<ValueListDisplayText>
Default value : this._valueListDisplayTextSignal.asReadonly()
Readonly valueListPairSignal
Type : Signal<string[]>
Default value : this._valueListPair.asReadonly()

Readonly signal exposing the value list pair.

Readonly valueListSignal
Type : Signal<string[]>
Default value : this._valueList.asReadonly()

Readonly signal exposing the value list.

Accessors

visible
getvisible()

Gets the component visibility

Returns : boolean
setvisible(value: boolean)

Sets the component visibility

Parameters :
Name Type Optional Description
value boolean No
  • The visibility state
Returns : void
selectedItem
getselectedItem()

Returns the selected combo option item.

Returns : ComboOption
setselectedItem(value: ComboOption)

Sets the selected combo option item.

Parameters :
Name Type Optional Description
value ComboOption No
  • The selected item.
Returns : void
formContainer
getformContainer()

Gets the form container view reference

Returns : "root" | ViewContainerRef
setformContainer(value: "root" | ViewContainerRef)

Sets the form container view reference

Parameters :
Name Type Optional Description
value "root" | ViewContainerRef No
  • The form container reference
Returns : void
enabled
getenabled()

Gets whether the component is enabled

Returns : boolean
setenabled(value: boolean)

Sets whether the component is enabled

Parameters :
Name Type Optional Description
value boolean No
  • The enabled state
Returns : void
id
getid()

Returns the component ID.

Returns : string
setid(value: string)

The component ID.

Parameters :
Name Type Optional
value string No
Returns : void
style
getstyle()

Gets the component style

Returns : any
setstyle(value: any)

Sets the component style

Parameters :
Name Type Optional Description
value any No
  • The style object
Returns : void
helpUrl
gethelpUrl()

Gets the help URL for the component

Returns : string
sethelpUrl(value: string)

Sets the help URL for the component

Parameters :
Name Type Optional Description
value string No
  • The help URL
Returns : void
ngModel
getngModel()

Gets the ngModel value

setngModel(value: any)

Sets the ngModel value and updates the combo when dropdown list is ready

Parameters :
Name Type Optional Description
value any No
  • The model value
Returns : void
smartValueList
setsmartValueList(value: string)

The SmartValueList that this combo editor should bind to.

Parameters :
Name Type Optional Description
value string No
  • The smart value list name
Returns : void
valueListPair
getvalueListPair()

Returns the value list pair array.

Returns : [] | null
setvalueListPair(value: string[] | null)

The value list pair array.

Parameters :
Name Type Optional
value string[] | null No
Returns : void
valueList
getvalueList()

Returns the value list array.

Returns : [] | null
setvalueList(value: string[] | null)

The value list array.

Parameters :
Name Type Optional
value string[] | null No
Returns : void
valueListEntries
getvalueListEntries()

Returns the repository value list entries.

Returns : [] | null
setvalueListEntries(value: SmartValueListEntry[] | null)

Repository value list entries.

Parameters :
Name Type Optional
value SmartValueListEntry[] | null No
Returns : void
keyField
getkeyField()

Gets the key field by which the combo editor filters its data source

Returns : string
setkeyField(value: string)

Sets the key field by which the combo editor should filter its data source

Parameters :
Name Type Optional Description
value string No
  • The key field name
Returns : void
displayColumnName
getdisplayColumnName()

Gets the field which should be used to display the combo editor's value

Returns : string
setdisplayColumnName(value: string)

Sets the field which should be used to display the combo editor's value

Parameters :
Name Type Optional Description
value string No
  • The display column name
Returns : void
imageFieldName
getimageFieldName()

Gets the image field name

Returns : string
setimageFieldName(value: string)

Sets the image field name

Parameters :
Name Type Optional Description
value string No
  • The image field name
Returns : void
imageSubstitute
getimageSubstitute()

Gets the image substitute pattern

Returns : string
setimageSubstitute(value: string)

Sets the image substitute pattern

Parameters :
Name Type Optional Description
value string No
  • The image substitute pattern
Returns : void
displayFields
getdisplayFields()

Gets the fields that will be used to render the Combo Editor's item template

Returns : string
setdisplayFields(value: string)

Sets the fields that will be used to render the Combo Editor's item template

Parameters :
Name Type Optional Description
value string No
  • Comma-separated list of display fields
Returns : void
displaySubstitute
getdisplaySubstitute()

Gets the pattern that will be used to render the Combo Editor's item template

Returns : string
setdisplaySubstitute(value: string)

Sets the pattern that will be used to render the Combo Editor's item template Example: [Field1] - [Field2]

Parameters :
Name Type Optional Description
value string No
  • The display substitute pattern
Returns : void
table
gettable()

Gets the entity table name

Returns : string
settable(value: string)

Sets the entity table name

Parameters :
Name Type Optional
value string No
Returns : void
tableView
gettableView()

Gets the entity view name

Returns : string
settableView(value: string)

Sets the entity view name

Parameters :
Name Type Optional Description
value string No
  • The entity view name
Returns : void
businessEntity
getbusinessEntity()

Gets the business entity name

Returns : string
setbusinessEntity(value: string)

Sets the business entity name

Parameters :
Name Type Optional Description
value string No
  • The business entity name
Returns : void
partialDataset
getpartialDataset()

Gets the deprecated partial dataset compatibility value.

Returns : boolean
setpartialDataset(value: boolean)

Deprecated no-op. Partial dataset handling is derived from the JSDO table reference root-table metadata.

Parameters :
Name Type Optional Description
value boolean No
  • Ignored compatibility value
Returns : void
selected
getselected()

Gets the selected record

Returns : any
setselected(value: any)

Sets the selected record

Parameters :
Name Type Optional Description
value any No
  • The selected record
Returns : void
filter
getfilter()

Gets the filter expression

Returns : any
setfilter(value: any)

Sets the filter expression

Parameters :
Name Type Optional Description
value any No
  • The filter expression
Returns : void
sort
getsort()

Gets the sort expression

Returns : any
setsort(value: any)

Sets the sort expression

Parameters :
Name Type Optional Description
value any No
  • The sort expression
Returns : void
parentDs
getparentDs()

Gets the parent data source name

Returns : string
setparentDs(value: string)

Sets the parent data source name

Parameters :
Name Type Optional Description
value string No
  • The parent data source name
Returns : void
allowFiltering
getallowFiltering()

Gets whether filtering (ComboBox) is enabled

Returns : boolean
setallowFiltering(value: boolean)

Sets whether filtering (ComboBox) is enabled

Parameters :
Name Type Optional Description
value boolean No
  • True to enable Kendo ComboBox mode
Returns : void
valueListDisplayText
getvalueListDisplayText()

Returns the display text mode for value lists.

setvalueListDisplayText(value: ValueListDisplayText)

Sets the display text mode for value lists.

Parameters :
Name Type Optional Description
value ValueListDisplayText No
  • The display text mode.
Returns : void
autoCompleteMode
getautoCompleteMode()

Returns the autocomplete mode.

Returns : string
setautoCompleteMode(value: string)

Sets the autocomplete mode.

Parameters :
Name Type Optional Description
value string No
  • The autocomplete mode.
Returns : void
autoSuggestFilterMode
getautoSuggestFilterMode()

Returns the autosuggest filter mode.

Returns : string
setautoSuggestFilterMode(value: string)

Sets the autosuggest filter mode.

Parameters :
Name Type Optional Description
value string No
  • The filter mode.
Returns : void
limitToList
getlimitToList()

Gets whether entries are limited to predefined list values

Returns : boolean
setlimitToList(value: boolean)

Sets whether entries are limited to predefined list values

Parameters :
Name Type Optional Description
value boolean No
  • True to limit selection to list values only
Returns : void
foreignFields
getforeignFields()

Gets the foreign fields for query string filtering

Returns : string
setforeignFields(value: string)

Sets the foreign fields for query string filtering

Parameters :
Name Type Optional Description
value string No
  • Comma-separated list of foreign field names
Returns : void
fieldBinding
getfieldBinding()

Returns the field binding expression.

Returns : any
setfieldBinding(value: any)

Sets the field binding expression.

Parameters :
Name Type Optional Description
value any No
  • The field binding.
Returns : void
flagValue
getflagValue()

Returns the flag value.

Returns : string
setflagValue(value: string)

Sets the flag value.

Parameters :
Name Type Optional Description
value string No
  • The flag value.
Returns : void
flagLabel
getflagLabel()

Returns the flag label.

Returns : string
setflagLabel(value: string)

Sets the flag label.

Parameters :
Name Type Optional Description
value string No
  • The flag label.
Returns : void
flagImage
getflagImage()

Returns the flag image URL.

Returns : string
setflagImage(value: string)

Sets the flag image URL.

Parameters :
Name Type Optional Description
value string No
  • The flag image URL.
Returns : void
queryString
getqueryString()

Gets the query string for filtering

Returns : string
setqueryString(value: string)

Sets the query string for filtering

Parameters :
Name Type Optional Description
value string No
  • The query string
Returns : void
provideForeignFieldValue
getprovideForeignFieldValue()

Returns the provider for foreign field values.

Returns : void | string
setprovideForeignFieldValue(value: (ev: ProvideForeignFieldValue) => void)

Sets the provider for foreign field values.

Parameters :
Name Type Optional Description
value function No
  • The provider function.
Returns : void
dropdownList
getdropdownList()

Gets the dropdown list options

Returns : ComboOption[]
setdropdownList(value: ComboOption[])

Sets the dropdown list options and adds flag option if configured

Parameters :
Name Type Optional Description
value ComboOption[] No
  • The dropdown list options
Returns : void
combo
getcombo()

Gets the combo component reference

Returns : ComboBoxComponent
setcombo(value: ComboBoxComponent)

Sets the combo component reference

Parameters :
Name Type Optional Description
value ComboBoxComponent No
  • The combo component
Returns : void
dropdown
getdropdown()

Gets the dropdown component reference

Returns : DropDownListComponent
setdropdown(value: DropDownListComponent)

Sets the dropdown component reference

Parameters :
Name Type Optional Description
value DropDownListComponent No
  • The dropdown component
Returns : void
comboBoxComponent
getcomboBoxComponent()

Gets the combo box component reference

Returns : ComboBoxComponent
dropDownListComponent
getdropDownListComponent()

Gets the drop down list component reference

Returns : DropDownListComponent
<!--
**************************************************************************
* Copyright © 2006-2026 by Consultingwerk Ltd. ("CW") -                  *
* www.consultingwerk.com and other contributors as listed                *
* below. All Rights Reserved.                                            *
*                                                                        *
*  Software is distributed on an "AS IS", WITHOUT WARRANTY OF ANY        *
*   KIND, either express or implied.                                     *
*                                                                        *
*  Contributors:                                                         *
*                                                                        *
**************************************************************************

--------------------------------------------------------------------------
    File        : smart-combo-editor.component.html
    Purpose     : Template for Smart Combo Editor.
    Author(s)   : Radu Nicoara
    Created     : Dec 07, 2017
--------------------------------------------------------------------------
-->
@let allowCustomInput = allowCustom$();
@let coercedModel = coercedNgModel$();

<ng-template #itemContent let-dataItem>
    @if (dataItem?.icon) {
        <span>
            <i class="item-icon" [ngClass]="dataItem.icon"></i>
        </span>
    } @else if (dataItem?.image) {
        <span class="template">
            <img class="item-image" [src]="dataItem.image">
        </span>
    }
    {{dataItem?.display}}
</ng-template>

@if (allowFiltering !== false) {
    <kendo-combobox 
            #combo 
            (blur)="onBlur()" 
            (focus)="focus.next()" 
            [clearButton]="false" 
            [ngStyle]="_styleSignal() || {}" 
            [hidden]="!_visibleSignal()" 
            [disabled]="!_enabledSignal()" 
            [allowCustom]="allowCustomInput"
            [valuePrimitive]="allowCustomInput" 
            [value]="allowCustomInput ? coercedModel : _selectedItemSignal()"
            [data]="_dropdownListSignal()" 
            [ngModel]="allowCustomInput ? coercedModel : _selectedItemSignal()" 
            [textField]="'display'" 
            [valueField]="'value'" 
            [popupSettings]="{ appendTo: _formContainerSignal() || 'component' }"
            (open)="setQueryStringFilter()" 
            (valueChange)="onComboSelectionChange($event)"
            >
                <ng-template kendoComboBoxItemTemplate let-dataItem>
                    <ng-container [ngTemplateOutlet]="itemContent"
                                  [ngTemplateOutletContext]="{ $implicit: dataItem }">
                    </ng-container>
                </ng-template>
                <ng-template kendoSuffixTemplate>
                    @for (button of editorButtons(); track button.key) {
                        <button
                            kendoButton
                            fillMode="flat"
                            themeColor="base"
                            [iconClass]="button.icon"
                            [smartEditorButton]="button"
                            (editorButtonClicked)="onEditorButtonClicked.emit($event)">
                            {{ button.label }}
                        </button>
                    }
                </ng-template>
    </kendo-combobox>
} @else {
    <div class="unfilterable-combobox-wrapper">
        <kendo-dropdownlist
            #dropdown 
            (blur)="onBlur()" 
            (focus)="focus.next()" 
            [ngStyle]="_styleSignal() || {}" 
            [hidden]="!_visibleSignal()" 
            [disabled]="!_enabledSignal()" 
            [value]="_selectedItemSignal()"
            [data]="_dropdownListSignal()"
            [ngModel]="_selectedItemSignal()" 
            [valuePrimitive]="false" 
            [textField]="'display'" 
            [valueField]="'value'" 
            (open)="setQueryStringFilter()" 
            [popupSettings]="{ appendTo: _formContainerSignal() || 'component' }"
            (valueChange)="onComboSelectionChange($event)">
                <ng-template kendoDropDownListItemTemplate let-dataItem>
                    <ng-container [ngTemplateOutlet]="itemContent"
                                    [ngTemplateOutletContext]="{ $implicit: dataItem }">
                    </ng-container>
                </ng-template>

                <ng-template kendoDropDownListValueTemplate let-dataItem>
                    <ng-container [ngTemplateOutlet]="itemContent"
                                    [ngTemplateOutletContext]="{ $implicit: dataItem }">
                    </ng-container>
                </ng-template>
        </kendo-dropdownlist>
        @for (button of editorButtons(); track button.key) {
            <button
                kendoButton
                [iconClass]="button.icon"
                [disabled]="!_enabledSignal()"
                [smartEditorButton]="button"
                [standaloneEditorButton]="true"
                (editorButtonClicked)="onEditorButtonClicked.emit($event)">
                {{ button.label }}
            </button>
        }
    </div>
}

@if (dataSourceId$() && _businessEntitySignal() && _tableSignal()) {
    <smart-data-source
        [smart-instance-name]="dataSourceId$()"
        [smart-business-entity-name]="_businessEntitySignal()"
        [smart-entity-table]="_tableSignal()"
        [smart-entity-view]="_tableViewSignal()"
        [smart-partial-dataset]="_partialDatasetSignal()"
        [smart-filter]="_filterSignal()"
        [smart-sort]="_sortSignal()"
        [smart-data-source]="_parentDsSignal()"
        [smart-auto-fetch]="false"
        [smart-read-requests-cancellable]="true">
    </smart-data-source>
}

./smart-combo-editor.component.scss

/**********************************************************************
 * Copyright © 2006-2026 by Consultingwerk Ltd. ("CW") -              *
 * www.consultingwerk.com and other contributors as listed            *
 * below. All Rights Reserved.                                        *
 *                                                                    *
 *  Software is distributed on an "AS IS", WITHOUT WARRANTY OF ANY    *
 *   KIND, either express or implied.                                 *
 *                                                                    *
 *  Contributors:                                                     *
 *                                                                    *
 **********************************************************************/
/*------------------------------------------------------------------------
    File        : smart-combo-editor.component.css
    Purpose     : Styles for Smart Combo Editor.
    Author(s)   : Radu Nicoara
    Created     : Dec 07, 2017
  ----------------------------------------------------------------------*/

::ng-deep [hidden] {
     display: none !important; 
}

/* the classes are  not applied */
.popup-visible {
     display: block;
}
.popup-hidden {
     display: none;
}

/* Target the Kendo UI container that holds both image and text */
::ng-deep .k-input-value-text {
     display: flex;
     align-items: center;
}

/* Target dropdown list items in the popup */
::ng-deep .k-list-item {
     display: flex;
     align-items: center;
}

.template {
     display: inline-flex;
     align-items: center;
     width: var(--kendo-spacing-4, 1rem); /* 16px equivalent */
     margin-right: var(--kendo-spacing-1, 0.25rem); /* Add some spacing between image and text */
}

.item-image {
     height: var(--kendo-spacing-4, 1rem); /* 16px equivalent */
     width: auto;
     max-width: 100%;
}

.item-icon {
     margin-right: var(--kendo-spacing-1, 0.25rem);
}

.unfilterable-combobox-wrapper {
     display: flex;
     flex-direction: row;
     gap: var(--kendo-spacing-1, 0.25rem);

     .k-dropdownlist {
          flex: 1;
     }
}
Legend
Html element
Component
Html element with directive

results matching ""

    No results matching ""