Constructor
# new Rating(config)
Its a Custom Web Component. Do not use the constructor directly with the new keyword. Instead, use one of the 3 following methods:
Create the Web Component and call its init method:
const myRating = document.createElement("a-rating").init(config)
Or use the shorthand for it:
const myRating = createRating({
label: "Rate me!",
max: 5,
iconColorOn: "#00aaee",
iconColorOff: "#dddddd"
})
myRating.render()
Or directly declare the config inside a container component:
const myPanel = createPanel({
title: "My panel",
items: [
{
type: "rating",
label: "Rate me!",
max: 5
}
]
})
myPanel.render()
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
config |
object
|
||
label |
string
|
||
max |
number
|
<optional> |
From 1 to 10 |
value |
number
|
<optional> |
Default value |
labelWidth |
string
|
<optional> |
|
labelPosition |
string
|
<optional> |
left | right | top | bottom |
labelAlign |
string
|
<optional> |
left | right |
fontSize |
string
|
<optional> |
|
shape |
string
|
<optional> |
star | heart | thumb |
iconSize |
string
|
<optional> |
|
iconColorOn |
string
|
<optional> |
|
iconColorOff |
string
|
<optional> |
|
formula |
string
|
<optional> |
|
width |
string
|
number
|
<optional> |
|
height |
string
|
number
|
<optional> |
|
margin |
string
|
<optional> |
|
padding |
string
|
<optional> |
|
readOnly |
boolean
|
<optional> |
|
disabled |
boolean
|
<optional> |
this
Generated markup
<a-rating class="a-rating">
<label class="field-label"></label>
<span class="field-rating">
<span class="rating" index="1">
<span class="rating" index="2">
<span class="rating" index="3">
<span class="rating" index="4">
<span class="rating" index="5">
</span>
</a-rating>
Methods
# setLabelPosition(position)
Set label position
Parameters:
Name | Type | Description |
---|---|---|
position |
string
|
"left" (default) | "right" | "top" | "bottom" |
this
# setValue(newValue, rawUpdateopt)
Set the field value
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
newValue |
boolean
|
The new field value |
|
rawUpdate |
boolean
|
<optional> |
If true, it doesn't update the associated record and doesn't trigger "change" event |
this