3 Replies Latest reply on Aug 16, 2017 8:33 AM by Sreeni13

    PiVision

    Sreeni13

      Hello,

           Is it possible to have a window pop-up in PiVision during a button click?

      Thanks in advance

        • Re: PiVision
          pmartin

          Hi Sreenivas,

           

          Do you mean something like this?

          popup.gif

           

          If so, you can use the window.open function on button click.  Here's the code for the symbol shown above:

           

          JS

          window.PIVisualization = window.PIVisualization || {};
          (function (PV) {
               'use strict';
          
               function symbolVis() { }
               PV.deriveVisualizationFromBase(symbolVis);
          
               symbolVis.prototype.init = function (scope, elem){
                    scope.click = function(){
                         window.open("https://www.google.com",null,"height=500,width=800,status=yes,toolbar=no,menubar=no,location=no,top=200,left=200");
                    }
               }
          
               var def = {
                    typeName: 'popupbutton',
                    datasourceBehavior: PV.Extensibility.Enums.DatasourceBehaviors.Single,
                    visObjectType: symbolVis,
                    getDefaultConfig: function(){
                         return{
                              DataShape: 'Value',
          
                              Height: 150,
                              Width: 450,
                              BackgroundColor: 'rgb(0,0,0)',
                              TextColor: 'rgb(0,255,0)',
                         };
                    }
               };
               PV.symbolCatalog.register(def);
          })(window.PIVisualization);
          

           

          HTML

          <div style="width:100%;height:100%" ng-style="{color: config.TextColor, background: config.BackgroundColor}" ng-click="click()"> </div>

          2 of 2 people found this helpful
          • Re: PiVision
            rsun

            You could also do that without programming because PI Vision 2017 has the functionality.

            Thanks,

            Ricky