diff --git a/docs/api/ui/typedInput/index.md b/docs/api/ui/typedInput/index.md index d4de6b0b..160e2598 100644 --- a/docs/api/ui/typedInput/index.md +++ b/docs/api/ui/typedInput/index.md @@ -152,11 +152,12 @@ RED.nodes.registerType('example', { ``` - ### Methods +Note that methods can only be called after setting the typedInput options. + #### disable( state ) *Since Node-RED 1.2.7* @@ -191,8 +192,6 @@ Enable the typedInput when it is currently disabled. $(".input").typedInput('enable'); ``` - - #### hide() Hide the typedInput when it is currently visible. @@ -274,6 +273,7 @@ Sets the width of the typedInput. $(".input").typedInput('width', '200px'); ``` + ### Events #### change( event, type, value ) @@ -286,6 +286,7 @@ $(".input").on('change', function(event, type, value) {} ); *Note:* The `value` property was added in Node-RED 1.3 + ### Types #### TypeDefinition @@ -396,6 +397,41 @@ $("#node-input-example5").typedInput({type:"fruit", types:[{
+#### Update types from change event + +```html + + +``` + +```javascript +$("#node-input-example6-1").typedInput({type:"mode", types:[{ + value: "mode", + options: [ + { value: "static", label: "Static"}, + { value: "dynamic", label: "Dynamic"}, + ] +}]}) + +$("#node-input-example6-2").typedInput({ + type:'str', + types:['str','env'] +}) + +$("#node-input-example6-1").on("change", function(event, type, value) { + if (value == "static") { + $("#node-input-example6-2").typedInput("types", ['str','env']) + } else { + $("#node-input-example6-2").typedInput("types", ['flow','global','msg']) + } +}) +``` + +
+ + +
+ ### Runtime handling of typed values @@ -502,6 +538,24 @@ $(function() { { value: "banana", label: "Banana"}, { value: "cherry", label: "Cherry"}, ] - }]}) + }]}) + $("#node-input-example6-1").typedInput({type:"mode", types:[{ + value: "mode", + options: [ + { value: "static", label: "Static"}, + { value: "dynamic", label: "Dynamic"}, + ] + }]}) + $("#node-input-example6-2").typedInput({ + type:'str', + types:['str','env'] + }) + $("#node-input-example6-1").on("change", function(event, type, value) { + if (value == "static") { + $("#node-input-example6-2").typedInput("types", ['str','env']) + } else { + $("#node-input-example6-2").typedInput("types", ['flow','global','msg']) + } + }) });