MultipleSelect Field
Definition of IMultiSelectField
, the usage example is as follows:
const multiSelectField = await table.getField<IMultiSelectField>(fieldId);
const multiSelectField = await table.getField<IMultiSelectField>(fieldId);
The corresponding data types are:
type IOpenSingleSelect = {
id: string;
text: string;
};
/** "Multiple Select" field cell type */
type IOpenMultiSelect = IOpenSingleSelect[];
type MultiSelectTransformVal = string[] | string | IOpenMultiSelect | IOpenSingleSelect;
interface ISelectFieldOption {
id: string;
name: string;
color: number;
}
type IOpenSingleSelect = {
id: string;
text: string;
};
/** "Multiple Select" field cell type */
type IOpenMultiSelect = IOpenSingleSelect[];
type MultiSelectTransformVal = string[] | string | IOpenMultiSelect | IOpenSingleSelect;
interface ISelectFieldOption {
id: string;
name: string;
color: number;
}
createCell
createCell: (val: MultiSelectTransformVal) => Promise<ICell>;
createCell: (val: MultiSelectTransformVal) => Promise<ICell>;
Creates a cell for the Multiple Select field.
getCell
getCell: (recordOrId: IRecordType | string) => Promise<ICell>;
getCell: (recordOrId: IRecordType | string) => Promise<ICell>;
Gets the cell value of the Multiple Select field for a given record.
setValue
setValue: (recordOrId: IRecordType | string, val: MultiSelectTransformVal) => Promise<boolean>;
setValue: (recordOrId: IRecordType | string, val: MultiSelectTransformVal) => Promise<boolean>;
Sets the value of the Multiple Select field for a given record.
getValue
getValue: (recordOrId: IRecordType | string) => Promise<IOpenMultiSelect>;
getValue: (recordOrId: IRecordType | string) => Promise<IOpenMultiSelect>;
Gets the value of the Multiple Select field for a given record.
addOption
addOption: (name: string, color?: number) => Promise<IFieldRes>;
addOption: (name: string, color?: number) => Promise<IFieldRes>;
Adds a new option for the field.
addOptions
addOptions: (optionList: { name: string, color?: number }[]) => Promise<IFieldRes>;
addOptions: (optionList: { name: string, color?: number }[]) => Promise<IFieldRes>;
Adds multiple new options for the field.
getOptions
getOptions: () => Promise<ISelectFieldOption[]>;
getOptions: () => Promise<ISelectFieldOption[]>;
Gets all the options for the field. The type definition of ISelectFieldOption
is:
interface ISelectFieldOption {
id: string;
name: string;
color: number;
}
interface ISelectFieldOption {
id: string;
name: string;
color: number;
}
deleteOption
deleteOption: (idOrName: string) => Promise<IFieldRes>;
deleteOption: (idOrName: string) => Promise<IFieldRes>;
Deletes an option by its ID or name.
setOption
setOption: (nameOrId: string, config: OptionConfig) => Promise<IFieldRes>;
setOption: (nameOrId: string, config: OptionConfig) => Promise<IFieldRes>;
Sets the configuration of an option by its ID or name. The type definition of OptionConfig
is:
export type OptionConfig = {
name?: string;
color?: number;
};
export type OptionConfig = {
name?: string;
color?: number;
};
setOptionsType
setOptionsType: (type: SelectOptionsType) => Promise<IFieldRes>;
setOptionsType: (type: SelectOptionsType) => Promise<IFieldRes>;
Sets the options type for the field. The type definition of SelectOptionsType
is:
enum SelectOptionsType {
STATIC, // Custom options
DYNAMIC, // Reference options
}
enum SelectOptionsType {
STATIC, // Custom options
DYNAMIC, // Reference options
}
getOptionsType
getOptionsType: () => Promise<SelectOptionsType>;
getOptionsType: () => Promise<SelectOptionsType>;
Gets the options type for the field. The type definition of SelectOptionsType
is:
enum SelectOptionsType {
STATIC, // Custom options
DYNAMIC, // Reference options
}
enum SelectOptionsType {
STATIC, // Custom options
DYNAMIC, // Reference options
}