2012-09-25 52 views
1

我希望有人可以帮忙,因为我一直在这一整天早上绞尽脑汁(我确信这是我做的一些愚蠢的事情)。JQGrid for JQuery只是给了一个空白页面

无论如何,我希望我们的系统中的数据能够显示在JQGrid中,我希望从一个页面加载数据,所以我使用的是StringXML功能,但是我遇到了问题,页面上没有显示任何内容,如果我包含警报显示,但即​​使所有文件加载正常并且错误控制台中没有错误,也不显示网格。

我粘贴了下面的代码,有没有什么明显的错误?

<HTML><HEAD> 
<script type='text/javascript' src='includes/jquery/jquery-1.7.2.min.js'></script> 
<script type='text/javascript' src='includes/jquery/jquery-ui-1.8.22.custom.min.js'></script> 
<link rel="stylesheet" type="text/css" media="screen" href="includes/jquery/jquery-ui-1.8.22.custom.css" /> 
<link rel="stylesheet" type="text/css" media="screen" href="includes/grid/ui.jqgrid.css" /> 
<script src="includes/grid/js/il8n/grid.locale-en.js" type="text/javascript"></script> 
<script src="includes/grid/js/jquery.jqGrid.min.js" type="text/javascript"></script> 
</HEAD><BODY> 
<SCRIPT>var liststr = "<?xml version='1.0' encoding='utf-8'?><GRIDDATA><ROWS> 
<ROW><CELL>Fri 24 Aug 2012 17:19</CELL><CELL>5</CELL></ROW> 
<ROW><CELL>Fri 24 Aug 2012 18:20</CELL><CELL>5</CELL></ROW> 
<ROW><CELL>Fri 24 Aug 2012 19:21</CELL><CELL>5</CELL></ROW> 
<ROW><CELL>Fri 24 Aug 2012 20:22</CELL><CELL>5</CELL></ROW> 
<ROW><CELL>Fri 24 Aug 2012 21:23</CELL><CELL>5</CELL></ROW> 
<ROW><CELL>Fri 24 Aug 2012 22:24</CELL><CELL>5</CELL></ROW> 
<ROW><CELL>Fri 24 Aug 2012 23:25</CELL><CELL>5</CELL></ROW> 
<ROW><CELL>Sat 25 Aug 2012 00:26</CELL><CELL>5</CELL></ROW> 
<ROW><CELL>Sat 25 Aug 2012 01:27</CELL><CELL>5</CELL></ROW> 
<ROW><CELL>Sat 25 Aug 2012 02:28</CELL><CELL>5</CELL></ROW> 
<ROW><CELL>Sat 25 Aug 2012 03:29</CELL><CELL>5</CELL></ROW> 
</ROWS></GRIDDATA>"; 

jQuery(document).ready(function() { 
      jQuery("#gridview").jqGrid({ 
      datatype: 'xmlstring', datastr: 'liststr', height: 250, 
      colNames:['Date', 'Lic1'], 
      colModel:[  
       {name:'date',index:'date', width:90, sorttype:'date'}, {name:'30300', index:'30300', width: 200, sorttype:'int'}], 
      multiselect: true, 
      caption: "Licenses in Use" 
      }) 
     ;} 
</SCRIPT> 
+0

我还没有尝试过,但可能它是大写的标签名 – Sonny

回答

2

1:你应该有一个<div id="gridview"></div>和 第二:在:

jQuery(document).ready(function() { 
      jQuery("#gridview").jqGrid({ 
      datatype: 'xmlstring', datastr: 'liststr', height: 250, 
      colNames:['Date', 'Lic1'], 
      colModel:[  
       {name:'date',index:'date', width:90, sorttype:'date'}, {name:'30300', index:'30300', width: 200, sorttype:'int'}], 
      multiselect: true, 
      caption: "Licenses in Use" 
      }) 
     ;} 

你已经错过的最新括号 “就绪的jQuery(文档)(” 所以,你的代码看起来应该像这样:

jQuery(document).ready(function() { 
      jQuery("#gridview").jqGrid({ 
      datatype: 'xmlstring', datastr: 'liststr', height: 250, 
      colNames:['Date', 'Lic1'], 
      colModel:[  
       {name:'date',index:'date', width:90, sorttype:'date'}, {name:'30300', index:'30300', width: 200, sorttype:'int'}], 
      multiselect: true, 
      caption: "Licenses in Use" 
      }); 
     }); 
+0

非常感谢缺少的括号肯定没有帮助,我发现在年底somethi数据问题? ng要知道每个人都确保你的ROW和CELL标签在小写字母!如果你像我的jqGrid那样大写它,它会忽略XMLSTRING数据。 – trevrobwhite

相关问题