Topic
  • 3 replies
  • Latest Post - ‏2013-04-05T15:40:03Z by SystemAdmin
SystemAdmin
SystemAdmin
445 Posts

Pinned topic ecm.widget.viewer.ContentViewer only opens item after second time

‏2013-03-06T19:48:47Z |
Hello. I've embedded the ecm.widget.viewer.ContentViewer dijit in my application. I'm discovering the viewer will only display the document after I trigger the ContentViewer.open(item) function more than one time. I thought it might be attributed to something I did wrong, however I noticed the same thing occurs with the ViewerEmbedSample.html IBM provided in the latest 2.0.1 samplePages application.

Is anyone else able to get the ViewerEmbededSample.html to work the first time?

While debugging I noticed something that could be preventing it from working the first time. It seems to fail on the _canOpenItem function located in the desktop.js model file (see below). The docViewer object is created outside of function related to the AMD module loading, so docViewer.canOpenItem(item) is undefined the first time since the module has fully loaded yet. I imagine this would be similar to trying to use a response outside of a XHR call?

I also noticed some similar situations in the ContentViewerPane.js file where dependent objects are being called outside of the requires.

From desktop.js file:

_canOpenItem: function(viewer, item) {

var viewerClass = viewer.getViewerClass();

var widgetReq = viewerClass.split('.').join('/');
var obj = null;

require(widgetReq, function(cls) {
docViewer = new cls();
});

var canOpenItem = docViewer.canOpenItem(item);
delete docViewer;
return canOpenItem;

}

Is my assessment here accurate?

Thanks in advance,

Ryan
  • SystemAdmin
    SystemAdmin
    445 Posts

    Re: ecm.widget.viewer.ContentViewer only opens item after second time

    ‏2013-03-06T19:55:13Z  
    Sorry, I should proof read a little better before posting. I meant to say the docViewer is created inside the function related to the AMD module loading.
  • SystemAdmin
    SystemAdmin
    445 Posts

    Re: ecm.widget.viewer.ContentViewer only opens item after second time

    ‏2013-03-07T21:11:24Z  
    Yes, we are aware of the issue and are working on a fix for it.

    It may be possible to work around it by explicitly specifying all of the DocViewer DOJO widgets in the ecm.widget.viewer in the widget that is embedding ContentViewer. This would hopefully preload the viewers, so that the follow-on dynamic load has no delay.

    Edited by: admin on Mar 7, 2013 4:10 PM
  • SystemAdmin
    SystemAdmin
    445 Posts

    Re: ecm.widget.viewer.ContentViewer only opens item after second time

    ‏2013-04-05T15:40:03Z  
    Yes, we are aware of the issue and are working on a fix for it.

    It may be possible to work around it by explicitly specifying all of the DocViewer DOJO widgets in the ecm.widget.viewer in the widget that is embedding ContentViewer. This would hopefully preload the viewers, so that the follow-on dynamic load has no delay.

    Edited by: admin on Mar 7, 2013 4:10 PM
    It looks like this issue was fixed in the latest 2.0.1 fix pack. Thank you very much!