Topic
2 replies Latest Post - ‏2013-01-22T19:55:09Z by P8GM_alejandro_amen
P8GM_alejandro_amen
P8GM_alejandro_amen
34 Posts
ACCEPTED ANSWER

Pinned topic How many times does the popup widget executes??

‏2013-01-18T19:21:58Z |
Hi,
How many times does the popup widget executes??

I made a custom widget using the popup widget I only need to add something in the resulting HTML that the widget returns, but only once.
I noticed that it executes many times and not only one.
The popup component in the other hand is executing only one time, thats ok.

I cant quite understand how this widget works.
Is there anyway to do this?

Thanks
Alejandro
Updated on 2013-01-22T19:55:09Z at 2013-01-22T19:55:09Z by P8GM_alejandro_amen
  • tmparker
    tmparker
    469 Posts
    ACCEPTED ANSWER

    Re: How many times does the popup widget executes??

    ‏2013-01-22T15:25:34Z  in response to P8GM_alejandro_amen
    Hi Alejandro,

    If you wrote a custom widget and have code that you want added to the HTML in the widget, this will happen every time we generate an instance of the widget. The widget is designed to be stand alone and it doesn't know about any other widget on the page already. So each time this widget needs to be displayed on the page we will generate the code for the widget the same way. When you say the component code is executing once it sounds like you are saying you are doing a default transformation and have this component/widget added as one of the rules. In that case, yes, we only do one pass at finding all instances on the screen that match this rule. However, once we do that it may generate several widgets if there are multiple places that are recognized.

    Thanks
    Tim
    • P8GM_alejandro_amen
      P8GM_alejandro_amen
      34 Posts
      ACCEPTED ANSWER

      Re: How many times does the popup widget executes??

      ‏2013-01-22T19:55:09Z  in response to tmparker
      Hi Tim,

      Yes, you are correct, I've made a custom component and a custom widget as well and using them in a default transformation.

      So, the dialog component must be returning not the dialog itself but all the components inside it for the widget to render, and not a "dialog" component as I suposed.

      I've found a solution by setting a gv in my custom component and checking it on the widget side so it only runs once, i think that this will do the trick.

      Thanks for your quick and exelent answer!
      Alejandro