Sending values from dashboard-template-node

Hello people,

I've implemented a date-time-picker in the node-red-dashboard-template-node.

<link rel="stylesheet" type="text/css" media="all" href="/daterangepicker/daterangepicker.css" />
<script type="text/javascript" src="/daterangepicker/daterangepicker.js"></script>
<script type="text/javascript" src="/moment/moment.min.js"></script>

<script>
    $(function(){
        $("#kt_daterangepicker_2").daterangepicker({
        "timePicker": true,
        "timePicker24Hour": true,
        startDate: moment().startOf("hour"),
        endDate: moment().startOf("hour").add(32, "hour"),
        locale: {
            format: "DD/MM hh:mm A",
            "applyLabel": "OK",
            "cancelLabel": "Abbrechen",
        }
        });
    });

</script>

<div class="mb-0">
    <label class="form-label">Zeitraum</label>
    <input class="form-control form-control-solid" placeholder="Wähle Zeitraum" id="kt_daterangepicker_2"/>
</div>

Everything is working fine but I dont know how to send the value to another node. I know there is a way to listen to incoming traffic with scope.$watch, is there a similar way to send messages?

If not: Can maybe the http nodes do it?

I havent noticed the chapter "sending messages" in the documentation.

So I already got the solution:

<link rel="stylesheet" type="text/css" media="all" href="/daterangepicker/daterangepicker.css" />
<script type="text/javascript" src="/daterangepicker/daterangepicker.js"></script>
<script type="text/javascript" src="/moment/moment.min.js"></script>

<script>
    $(function(){
        $("#kt_daterangepicker_2").daterangepicker({
        "timePicker": true,
        "timePicker24Hour": true,
        startDate: moment().startOf("hour"),
        endDate: moment().startOf("hour").add(32, "hour"),
        locale: {
            format: "DD/MM hh:mm A",
            "applyLabel": "OK",
            "cancelLabel": "Abbrechen",
        }
        });       
    });
    this.scope.action = function() { return document.getElementById("kt_daterangepicker_2").value }
</script>

<div class="mb-0">
    <label class="form-label">Zeitraum</label>
    <input class="form-control form-control-solid" placeholder="Wähle Zeitraum" id="kt_daterangepicker_2"/>
</div>

<md-button ng-click="send({payload:action()})">
    Absenden
</md-button>
1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.