Menu

Important: This documentation is about an older version. It's relevant only to the release noted, many of the features and functions have been updated or replaced. Please view the current version.

Enterprise Open source

Cascader class

Signature

typescript
export declare class Cascader extends React.PureComponent<CascaderProps, CascaderState> 

Import

typescript
import { Cascader } from '@grafana/ui';

Constructors

ConstructorModifiersDescription
constructor(props)Constructs a new instance of the Cascader class

Properties

PropertyModifiersTypeDescription
defaultPropsstatic{
changeOnSelect: boolean;
}
flattenOptions(options: CascaderOption[], optionPath?: CascaderOption[]) => SelectableValue<string[]>[]
getSearchableOptionsimport("memoize-one").MemoizedFn<(options: CascaderOption[]) => SelectableValue<string[]>[]>
onBlur() => void
onBlurCascade() => void
onChange(value: string[], selectedOptions: CascaderOption[]) => void
onCreateOption(value: string) => void
onInputKeyDown(e: React.KeyboardEvent<HTMLInputElement>) => void
onSelect(obj: SelectableValue<string[]>) => void

Methods

MethodModifiersDescription
render()
setInitialValue(searchableOptions, initValue)

constructor(props)

Constructs a new instance of the Cascader class

Signature

typescript
constructor(props: CascaderProps);

Parameters

ParameterTypeDescription
propsCascaderProps

defaultProps property

Signature

typescript
static defaultProps: {
        changeOnSelect: boolean;
    };

flattenOptions property

Signature

typescript
flattenOptions: (options: CascaderOption[], optionPath?: CascaderOption[]) => SelectableValue<string[]>[];

getSearchableOptions property

Signature

typescript
getSearchableOptions: import("memoize-one").MemoizedFn<(options: CascaderOption[]) => SelectableValue<string[]>[]>;

onBlur property

Signature

typescript
onBlur: () => void;

onBlurCascade property

Signature

typescript
onBlurCascade: () => void;

onChange property

Signature

typescript
onChange: (value: string[], selectedOptions: CascaderOption[]) => void;

onCreateOption property

Signature

typescript
onCreateOption: (value: string) => void;

onInputKeyDown property

Signature

typescript
onInputKeyDown: (e: React.KeyboardEvent<HTMLInputElement>) => void;

onSelect property

Signature

typescript
onSelect: (obj: SelectableValue<string[]>) => void;

render method

Signature

typescript
render(): JSX.Element;

Returns:

JSX.Element

setInitialValue method

Signature

typescript
setInitialValue(searchableOptions: Array<SelectableValue<string[]>>, initValue?: string): {
        rcValue: string[];
        activeLabel: any;
    };

Parameters

ParameterTypeDescription
searchableOptionsArray<SelectableValue<string[]>>
initValuestring

Returns:

{ rcValue: string[]; activeLabel: any; }