davidtorres
(david torres)
February 10, 2022, 11:27am
1
Hello,
I would like to know where to find the parameters supported in actionFeedback within a Toast. The most I’ve found is this thread with the same question but no solution.
https://community.openhab.org/t/oh3-actionfeedback-parameters/117029
Example:
Code:
actionFeedback: ='{ "text":"You selected <b>' + loop.option.label + '</b><br>Sending command <b>' + loop.option.value + '</b> to item", "position":"center","icon":"<i style=\\"color:green\\" class=\\"f7-icons\\">checkmark_alt</i>","closeButton":true }'
I would need to know the rest of the supported parameters and/or some example.
Thanks!
JustinG
(JustinG)
February 10, 2022, 2:55pm
2
All of these things derive from the f7 versions, so the f7 docs give you what you need to know if you’re interested in this level of detail:
Hello Justin,
I have come to that document several times and tried the following without success:
actionFeedback: ='{ "text":"<b>Generando</b>' + '<br>Espere</br>", "position":"center","icon":"<i style=\\"color:orange\\" class=\\"f7-icons\\">timer</i>", "closeButton":true, "closeTimeout":5000}'
and
actionFeedback: ='{ "text":"<b>Generando</b>' + '<br>Espere</br>", "position":"center","icon":"<i style=\\"color:orange\\" class=\\"f7-icons\\">timer</i>", "closeButton":t"rue", "closeTimeout":"5000"}'
It seems that not all parameters work. Or maybe it’s me…
It only shows 3 seconds and the close button not exists
Thanks
JustinG
(JustinG)
February 10, 2022, 4:24pm
4
Looking into the actions code, it seems that because you have icon
set, your closeTimeout
value is getting overwritten by the default value:
if (typeof toastConfig === 'string' && toastConfig.startsWith('{')) toastConfig = JSON.parse(toastConfig)
if (typeof toastConfig === 'string') {
this.$f7.toast.create({
text: toastConfig,
destroyOnClose: true,
closeTimeout: 2000
}).open()
} else if (typeof toastConfig === 'object') {
this.$f7.toast.create(Object.assign({}, toastConfig, {
destroyOnClose: true,
closeTimeout: (toastConfig.icon || !toastConfig.closeButton) ? 2000 : toastConfig.closeTimeout
})).open()
}
},
performAction (evt, prefix) {
if (!this.context || !this.config) return
const actionPropsParameterGroup = this.config[((prefix) ? prefix += '_' : '') + 'actionPropsParameterGroup']
const actionConfig = (actionPropsParameterGroup) ? this.evaluateExpression('$props', this.context.props) : this.config
prefix = (actionPropsParameterGroup) ? actionPropsParameterGroup.replace(/action/gi, '') : prefix
prefix = (prefix) ? prefix += '_' : ''
const action = actionConfig[prefix + 'action']
I’m not sure if this is intentional or why this would be the case, perhaps @ysc can comment on what’s going on here.
ysc
(Yannick Schaus)
February 10, 2022, 10:24pm
5
I have no idea
This doesn’t seem right.
ysc
(Yannick Schaus)
February 10, 2022, 10:28pm
6
I would assume that if you put icon
in your config, your intent was to make something like the 4th button/example in Toast | Framework7 Documentation , so to avoid problems if you didn’t specify a closeTimeout, it’s specified for you.
Hi Yannick, thanks for your reply. And you too @JustinG Justin. My intention is to make the fourth example as you say but to be able to customize more with:
I didn’t quite understand your answer/guidance…