Hey I am trying to build a node for that taking input from user in dashboard and filter data based on input but ** i count not access array variable in .js ( undefined )** file can someone help
contents of .html are :
<script type="text/javascript">
RED.nodes.registerType('hello-world',{
category: 'function',
color: '#e2d96e',
defaults: {
name: {value:""},
dataVariable : { value : [1,2,3] }
},
inputs:1,
outputs:1,
icon: "white-globe.png",
label: function() {
return this.name||"hello-world";
}
});
</script>
<script type="text/x-red" data-template-name="hello-world">
<div class="form-row">
<label for="node-input-name"><i class="icon-tag"></i> Name</label>
<input type="text" id="node-input-name" placeholder="Name">
</div>
</script>
<script type="text/x-red" data-help-name="hello-world">
<p>A simple node that changes the message payloads to Hello World</p>
</script>
contents of .js :
module.exports = function (RED) {
"use strict";
function HelloWorldNode(config) {
RED.nodes.createNode(this, config);
this.dataVariable = config.dataVariable ;
var node = this;
this.on('input', function (msg) {
msg.payload = node.dataVariable;
node.send(msg);
});
}
RED.nodes.registerType("hello-world", HelloWorldNode);
};