Rating Field
The Rating field represents a field that allows users to rate a value on a scale. It can be used to collect ratings from users, such as product ratings or user satisfaction ratings.
Interface Definition
The interface IRatingField
represents the Rating field type. You can use it to define a variable that represents a Rating field.
const ratingField = await table.getField<IRatingField>(fieldId);
const ratingField = await table.getField<IRatingField>(fieldId);
The corresponding data type for the Rating field is:
type IOpenNumber = number;
type IOpenNumber = number;
Methods
The Rating field interface provides the following methods:
createCell
This method creates a new cell for the Rating field, with the specified value.
createCell: (val: IOpenNumber) => Promise<ICell>;
createCell: (val: IOpenNumber) => Promise<ICell>;
getCell
This method retrieves the cell for the Rating field in the specified record.
getCell: (recordOrId: IRecordType | string) => Promise<ICell>;
getCell: (recordOrId: IRecordType | string) => Promise<ICell>;
setValue
This method sets the value of the Rating field in the specified record.
setValue: (recordOrId: IRecordType | string, val: IOpenNumber) => Promise<boolean>;
setValue: (recordOrId: IRecordType | string, val: IOpenNumber) => Promise<boolean>;
getValue
This method retrieves the value of the Rating field in the specified record.
getValue: (recordOrId: IRecordType | string) => Promise<IOpenNumber>;
getValue: (recordOrId: IRecordType | string) => Promise<IOpenNumber>;
getMin
This method retrieves the minimum value allowed for the Rating field.
getMin: () => Promise<IRatingMinVal>;
getMin: () => Promise<IRatingMinVal>;
The IRatingMinVal
type is defined as follows:
type IRatingMinVal = 0 | 1;
type IRatingMinVal = 0 | 1;
setMin
This method sets the minimum value allowed for the Rating field.
setMin: (min: IRatingMinVal) => Promise<IFieldRes>;
setMin: (min: IRatingMinVal) => Promise<IFieldRes>;
The IRatingMinVal
type is defined as follows:
type IRatingMinVal = 0 | 1;
type IRatingMinVal = 0 | 1;
getMax
This method retrieves the maximum value allowed for the Rating field.
getMax: () => Promise<number>;
getMax: () => Promise<number>;
setMax
This method sets the maximum value allowed for the Rating field.
setMax: (max: number) => Promise<IFieldRes>;
setMax: (max: number) => Promise<IFieldRes>;
getRatingIcon
This method retrieves the icon used for the Rating field.
getRatingIcon: () => Promise<RatingIconType>;
getRatingIcon: () => Promise<RatingIconType>;
The RatingIconType
enum represents the possible values for the icon:
enum RatingIconType {
STAR = 'star',
HEART = 'heart',
THUMBSUP = 'thumbsup',
FIRE = 'fire',
SMILE = 'smile',
LIGHTNING = 'lightning',
FLOWER = 'flower',
NUMBER = 'number',
}
enum RatingIconType {
STAR = 'star',
HEART = 'heart',
THUMBSUP = 'thumbsup',
FIRE = 'fire',
SMILE = 'smile',
LIGHTNING = 'lightning',
FLOWER = 'flower',
NUMBER = 'number',
}
setRatingIcon
This method sets the icon used for the Rating field.
setRatingIcon: (icon: RatingIconType) => Promise<IFieldRes>;
setRatingIcon: (icon: RatingIconType) => Promise<IFieldRes>;
The RatingIconType
enum represents the possible values for the icon:
enum RatingIconType {
STAR = 'star',
HEART = 'heart',
THUMBSUP = 'thumbsup',
FIRE = 'fire',
SMILE = 'smile',
LIGHTNING = 'lightning',
FLOWER = 'flower',
NUMBER = 'number',
}
enum RatingIconType {
STAR = 'star',
HEART = 'heart',
THUMBSUP = 'thumbsup',
FIRE = 'fire',
SMILE = 'smile',
LIGHTNING = 'lightning',
FLOWER = 'flower',
NUMBER = 'number',
}