2011-05-06 74 views
1

我想加载一个包含一些dojo代码的页面时遇到了问题。加载的页面不显示任何信息。Jquery和Dojo DataGrid问题

我所加载的网页,index.html的样子说:

<html> 
<head> 
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/dojo/1.5/dojo/dojo.xd.js" djConfig="parseOnLoad: true"> 
//to fill 
</script> 
    <link rel="stylesheet" type="text/css" href="http://ajax.googleapis.com/ajax/libs/dojo/1.5/dijit/themes/claro/claro.css"/> 
    </head> 
    <body> 
    <div id="mainFrame"> 
<script type="text/javascript" > 
$('#mainFrame').load('/Page.html'); 
</script> 
</div> 
    </body> 
    <html> 

我的第二页包含的代码来显示一个DataGrid:当我运行这段代码Pahe.html

<html> 
    <head> 
    <link rel='stylesheet' type='text/css' href='http://ajax.googleapis.com/ajax/libs/dojo/1.5/dojox/grid/resources/claroGrid.css'/> 
     <script type="text/javascript" > 
     dojo.require("dojox.grid.DataGrid"); 
     dojo.require("dojo.data.ItemFileReadStore"); 
     function prepare() { 
      var data0 =[{FristName:'jean',LastName:'edu',Course:'english'}]; 
      var store0 = new dojo.data.ItemFileReadStore({ 
      data: { 
      items: data0 
      } 
      }); 
      var grid0 = new dojox.grid.DataGrid({ 
      store: store0, 
      structure: [ 
      {field: 'FirstName', name: 'FirstName', width:'auto'}, 
      {field: 'LastName', name: 'LastName', width:'auto'}, 
      {field: 'Course', name: 'Course', width:'auto'} 
      ], 
      rowsPerPage: 20, 
      clientSort : true, 
      rowSelector : '10px' 
      }, "grid0"); 
      grid0.startup(); 
     } 
     dojo.addOnLoad(prepare); 
    </script> 
    </head> 
    <body> 
    <div id="grid0"/> 
    </body> 
    </html> 

在浏览器中,我看到了。然而,我看到与谷歌浏览器的前景工具,浏览器加载的数据网格dojo ...

我认为这是一个jquery的负载问题,因为如果我添加代码来加载脚本在页面.html',我可以看到一些东西...我客人说jquery和dojo出了问题...

你能帮我解决吗?

由于提前,

蝙蝠

回答

0

只是想大声这里也许,但你调用$(“#的mainFrame”)上方内嵌相应的“主机”格在文档中。这会工作吗?我会认为js调用需要位于文档中的“mainframe”div下方。

我会尝试将该调用移出“head”,并将其放在“mainframe”div之后的某个位置。

+0

我改变了代码(在我的主题上编辑)。但我仍然有这个问题。 – user376112 2011-05-06 13:36:14

0

我去看看针对JQuery的负载API文档,但它带来了一个空白页:-)

我不知道正是它,特别是HEAD元素,但如果它是简单地做就像innerHTML分配一样,它不能用于Dojo的代码加载器或CDN跨域加载。您可能希望在页面加载时执行Dojo代码。

0

2建议:

1-您可能需要进口道场电网 “基地” 网格CSS。

<link rel="stylesheet" type="text/css" href="http://ajax.googleapis.com/ajax/libs/dojo/1.5/dojox/grid/resources/Grid.css"> 

2 - 您可能还需要设置数据网格的高度(以像素为单位百分比...不与数据网格工作)。