2 Replies Latest reply on May 10, 2016 3:00 AM by lpthingworx RSS
    lpthingworx Explorer

    open a thingworx popup from html anchor tag.

    Hi,

    i have created my own thingworx list widget using HTML template and angular js, that list have one column which rendered html anchor tag. currently on click of that anchor it opens new browser window.

     

    anchor tag html looks like as below.

    <a href="http://www.facebook.com/sharer" onclick="window.open(this.href, 'mywin','left=20,top=20,width=1024,height=600,toolbar=1,resizable=0'); return false;" >my image</a>

     

    can we open thingworx popup instead of browser window on click of html anchor tag?

     

    Regards,

    Lalit

      • Re: open a thingworx popup from html anchor tag.
        pchung Collaborator

        Take a look at the Navigation Widget which has the ability to do so.

        • Re: open a thingworx popup from html anchor tag.
          lpthingworx Explorer

          Hi,

          i have resolved this issue. I followed as below, also added some code snippet for better reference.

           

          1) Created one widgetEvent in .ide.js file.

           

          this.widgetEvents = function() {

            return {

                 'linkClicked': { 'warnIfNotBound': true }

            }

          };

           

          2) Created one function in .runtime.js file, that function will trigger Event created in .ide file

           

          $scope.imageLinkClicked = function(item) {

                 $scope.widget.jqElement.triggerHandler('linkClicked');

          };

           

          3) In HTML template file, on click of anchor tag called function created in .runtime.js file

           

          <td data-ng-repeat="document in item.Documents.rows" style="padding-right:5px;">

            <div data-ng-click="imageLinkClicked(item)">{{document.Name}}</div>

          </td>

           

          4) In Mashup, bound navigate event of navigation with linkClicked(this we have created in .ide.js file).

           

          Thanks,

          Lalit