2012-04-16 69 views
0

我有一个dojo的小问题。 在我的XPages应用程序中,我想用dojox.image.Gallery实现一个imageGallery。dojox.image.Gallery,undefined图片来源

我已经设置了一切,我的代理返回了一些JSON数据,到目前为止似乎是有效的。

它的结构是这样的:

{项目:[ { “拇指”: “linktothumbnail”, “大”: “linktolargepic”, “称号”: “whatever1”, “链接“:”www.google.de“ },{...等等......

图片的URL有效,请检查它。

一切正常,没有错误信息,除了一个。 “NetworkError:404未找到 -​​” 我Thumbnailpicker的src属性是“未定义”

我爬在网上,没有结果为止。

这是我在的XPage代码:

<xp:this.resources> 
     <xp:dojoModule name="dojox.image.Gallery"></xp:dojoModule> 
     <xp:dojoModule name="dojo.data.ItemFileReadStore"></xp:dojoModule> 
     <xp:dojoModule name="dojo.parser"></xp:dojoModule> 
    </xp:this.resources> 
    <xp:div id="Wrapper"> 
     Test 

     <div jsId="imageItemStore" dojoType="dojo.data.ItemFileReadStore" 
      url="#{javascript:return facesContext.getExternalContext().getRequestContextPath() + '/returnMemberDataJSON?OpenAgent';}"> 
     </div> 

     <div id="gallery1" dojoType="dojox.image.Gallery" imageHeight="400" imageWidth="550"> 
      <script type="dojo/connect"> 
       var itemRequest = { 
        query: {}, 
        count: 20 
       }; 
       var itemNameMap = { 
        imageThumbAttr: "label", 
        imageLargeAttr: "name" 
       }; 
       this.setDataStore(imageItemStore, itemRequest, itemNameMap); 
      </script> 
     </div> 

    </xp:div> 

似乎有效的给我。我已经通过一个主题实现了dojo样式,因为它似乎没有自动完成。所有需要的图片也被导入。

我的页面上的结果是ThumbnailPicker应该在的地方,在代码中没有任何东西,但没有显示任何东西。在那之下,我得到了带有按钮的幻灯片的框,但没有图片。

你有什么想法可能出了什么问题或者出于某种原因在XPages中不起作用?

在此先感谢。

回答

0

这可能与

<script type="dojo/connect"> 

一部分。我在dojo/connect事件中遇到了一些特定于浏览器的问题。相反,您可以尝试将以下CS JavaScript添加到XPage /自定义控件的onClientLoad中:

dojo.addOnLoad(function() { 
    var itemRequest = { query: {}, count: 20 }; 
    var itemNameMap = { imageThumbAttr: "label", imageLargeAttr: "name" }; 
    dijit.byId('gallery1').setDataStore(imageItemStore, itemRequest, itemNameMap); 
});