Select to view content in your preferred language

Loading widget programmatically fails in IE 8&9

645
2
08-19-2013 07:34 AM
GennadyOster
Deactivated User
Hi !

I need to load one of widgets dynamically (as a response to certain URL parameter).
I decided that the most suitable place to do it is HeaderControllerWidget:
    if ((ViewerContainer.urlConfigParams.street != null && ViewerContainer.urlConfigParams.house != null) )
    {
     var addrWidgetID:Number;
     var addrWidget:IBaseWidget;
     addrWidgetID = ViewerContainer.getInstance().widgetManager.getWidgetId(addrWidgetLabel);
     addrWidget = ViewerContainer.getInstance().widgetManager.getWidget(addrWidgetID,true);
     return;
    }


It works fine in IE10, Chrome and FF, but in the IE8/9 the widget is never loaded and cursor stays in the busy state. System is waiting, and when I load this widget manually - it continues to function properly.
Here is the link:
Test link
When cleaning the IE cache, the first run is successful, but only once. I tried to play with cache definitions without any success.

Can somebody please shed light on this strainge behavior ?

Thanks in advance.
Regards,
Gennady
Tags (2)
0 Kudos
2 Replies
GennadyOster
Deactivated User
Finally I've found... Not the cause of the problem yet, but at list the work around.
Or may be my previous way should be called "work around"?
In short, instead of calling
ViewerContainer.getInstance().widgetManager.getWidget(addrWidgetID,true);
directly I've used

AppEvent.dispatch(AppEvent.WIDGET_RUN, addrWidgetID);


Maybe anyway somebody can explain what was wrong in the first version and why it didn't work only in IE8 and 9?

Thanks.
Regards,
Gennady
0 Kudos
RobertScheitlin__GISP
MVP Emeritus
Gennady,

  The first code is for getting a reference to the widget to be able to call a function in the widget but it this can sometimes cause some timing issues as you have found. The second code is just for running (opening) the widget and is better suited for just opening the widget.
0 Kudos