In the UI Editor how to change the interface depending on a config node

I have a Node which UI configuration points to a Config node. Now I want to change the edit interface of my Node (hiding some fields) depending on the value of a configuration field within the referred Config Node.

Is that possible? If so how I can do that?


You are writing a custom node, that has a configuration node?
I haven't tried this yet in practice, but from a bit of brainstorming, you could try to have the fields exist in the base node.html file, but define a oneditprepare where the input field is grabbed and css display is set to none, I think jquery has a .hide() function for it but it's years since I've used that. Then an oneditsave to set the values to null or whatever you want to save them as for those that haven't been entered by the user. Thus hiding them from the view, but the input fields won't be deleted.

Hey Jose,

Perhaps you can do it like I use it here:

var configNodeId = $("#node-input-deviceConfig").val();
if (configNodeId) {
    configNode = RED.nodes.node(configNodeId);
    // Get here data from you config node

Not sure at the moment how it behaves when the user has edited the settings of the config node, and switch back to the config screen of your custom node. When not deployed the config node changes, I'm not sure whether you get the changed or unchanged config node properties. I'm not at home to test this ...