Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

UI Radio Group - server side data storing issue fix #1246

Merged
merged 5 commits into from
Aug 29, 2024
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 15 additions & 3 deletions nodes/widgets/ui_radio_group.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
const statestore = require('../store/state.js')
const { appendTopic } = require('../utils/index.js')

module.exports = function (RED) {
function RadioGroupNode (config) {
Expand All @@ -12,11 +13,22 @@ module.exports = function (RED) {

const evts = {
onChange: true,
beforeSend: function (msg) {
if (msg.options) {
beforeSend: async function (msg) {
const updates = msg.ui_update
console.log('ui_radio_group: beforeSend', msg)
joepavitt marked this conversation as resolved.
Show resolved Hide resolved
if (typeof updates?.label !== 'undefined') {
// dynamically set "label" property
statestore.set(group.getBase(), node, msg, 'label', updates.label)
}
if (typeof updates?.columns !== 'undefined') {
// dynamically set "columns" property
statestore.set(group.getBase(), node, msg, 'columns', updates.columns)
}
if (updates.options) {
joepavitt marked this conversation as resolved.
Show resolved Hide resolved
// dynamically set "options" property
statestore.set(group.getBase(), node, msg, 'options', msg.options)
statestore.set(group.getBase(), node, msg, 'options', updates.options)
}
msg = await appendTopic(RED, config, node, msg)
return msg
}
}
Expand Down
Loading