Options
All
  • Public
  • Public/Protected
  • All
Menu

View Model for the Selector widget.

Type parameters

  • T

Hierarchy

Index

Constructors

constructor

Events

onSelectItem

  • Invoked when an item is selected.

    Parameters

    Returns void

onUnselectItem

  • Invoked when an item is unselected.

    Parameters

    Returns void

Properties

Protected _isDestroyed

_isDestroyed: boolean

app

displayNameField

displayNameField: string

dummyItem

dummyItem: SelectorItemViewModel<any>

dummyItemText

dummyItemText: string

id

id: string

items

libraryId

libraryId: string

mobileMode

mobileMode: boolean

noItemsText

noItemsText: Observable<string>

openState

openState: Observable<boolean>

selectedItems

selectorText

selectorText: Observable<string>

showNativeSelect

showNativeSelect: Observable<boolean>

showSelectorHeader

showSelectorHeader: Observable<boolean>

singleSelect

singleSelect: boolean

syncToken

syncToken: any

templateLibraryId

templateLibraryId: string

templatePath

templatePath: string

templateTypeName

templateTypeName: string

Methods

auto

  • auto(arg0: any, arg1: any, arg2: any): void
  • Binds a handler to an Observable or to a dojo.connect. Binding to an Observable:

    ``` this.auto(someObservable, function (newValue) { });

    with explicit scope:

    this.auto(someObservable, this, function (newValue) { });

    Alternately, pass an event name as a string to use dojo.connect:

    this.auto(window, "onclick", function () { }); ```

    Parameters

    • arg0: any

      Either an Observable (for observable bindings) or a regular object (if arg1 is a string)

    • arg1: any

      If arg0 is an Observable, a function or scope object. Otherwise, an event name (to use with dojo.connect).

    • arg2: any

      If arg0 is an Observable, a function handler.

    Returns void

clear

  • clear(): void
  • Returns void

destroy

  • destroy(): void
  • Destroys the object completely

    Returns void

destroyBindings

  • destroyBindings(): void

getResource

  • getResource(resourceKey: string, locale?: string): string
  • Gets a language resource from the Application's resource dictionary, given a key, and optional locale. Returns null if the resource does not exist.

    Parameters

    • resourceKey: string
    • Optional locale: string

      The locale of the resource to fetch. Defaults to the current application locale.

    Returns string

getSelectedItems

getViewModelForItem

  • Given an underlying item, returns the view model for it.

    Parameters

    • item: T

      The underlying item to find the view model for.

    Returns SelectorItemViewModel<T>

getViewModelForSelectedItem

  • Gets a view model for an item, provided that the item is selected.

    Parameters

    • item: T

      The item.

    Returns SelectorItemViewModel<T>

handleSelectionChange

  • Handles changes to the selected state of a view model.

    Parameters

    • selected: boolean

      Whether or not the given item is selected.

    • itemViewModel: SelectorItemViewModel<T>

      The view model to handle selection change for.

    Returns void

handleUnderlyingCollectionChange

  • Handles changes in the underlying collection, adapting new items and removing entries for items that have been removed.

    Parameters

    • changedArgs: CollectionChangedArgs

      An instance of {@link events.CollectionChangedArgs} representing the collection change.

    Returns void

hasItemViewModelFor

  • hasItemViewModelFor(item: T): boolean
  • Returns true or false based on the existence of a view model for a particular item.

    Parameters

    • item: T

      The item that may or may not have a corresponding view model.

    Returns boolean

initialize

  • initialize(config: any): void

onDestroy

  • onDestroy(): void
  • Override or attach to provide custom clean-up behaviour.

    Returns void

selectItem

  • Selects an item, given either an item or a SelectorItemViewModel for an item.

    Parameters

    • item: T

      The underlying item to select for. Pass null if you have a SelectorItemViewModel already.

    • Optional itemViewModel: SelectorItemViewModel<T>

      The view model, already obtained, to select. Pass null if you just have a raw item.

    Returns void

setCollection

  • setCollection(collection: ObservableCollection<T>, displayNameField: string, templatePath?: string, templateLibraryId?: string, templateTypeName?: string): void
  • Sets the underlying collection and enables selection of items from it.

    Parameters

    • collection: ObservableCollection<T>

      The collection of items to model selection for.

    • displayNameField: string

      The name of the field to use on the underlying items for selection.

    • Optional templatePath: string

      The resource path of the HTML template to use for rendering.

    • Optional templateLibraryId: string
    • Optional templateTypeName: string

    Returns void

toggleOpenState

  • toggleOpenState(): void
  • Toggles the state of the selector menu, expanding or collapsing it.

    Returns void

trackCommandHandler

  • trackCommandHandler(command: any, token: any): void
  • Tracks a subscription to an {@link geocortex.framework.commands.Command}, disposing it when this object is disposed with the destroy method.

    Parameters

    • command: any
    • token: any

    Returns void

trackSubscription

  • trackSubscription(event: any, token: any): void
  • Tracks a subscription to an {@link geocortex.framework.events.Event}, disposing it when this object is disposed with the destroy method.

    Parameters

    • event: any
    • token: any

    Returns void

unselectAll

  • Unselects any selected items.

    Parameters

    • Optional exceptForItem: SelectorItemViewModel<T>

      An item to ignore...this item's selected state will not be changed, i.e. because it is intended to be the only selected item.

    Returns void

unselectItem

  • Unselects an item, given either an item or a SelectorItemViewModel for an item.

    Parameters

    • item: T

      The underlying item to unselect for. Pass null if you have a SelectorItemViewModel already.

    • Optional itemViewModel: SelectorItemViewModel<T>

      The view model, already obtained, to select. Pass null if you just have a raw item.

    Returns void