【发布时间】:2013-08-02 02:46:27
【问题描述】:
当我单击一个链接时,它应该加载我的 jqGrid 一些数据。我正在将要显示的数据转换为 json 并尝试填充数据。我检查了我的 json 对象(我使用 Gson().tojson(listObject) 进行转换)及其打印正确。
然而点击Data=localhost:8080/App/jsp/servlet?Param1=xxxx&Param2=333,我无法加载数据,我使用Firebug和F12开发者做了一些调查,发现该请求未发送到 servlet 以获取数据。不知道出了什么问题。我是 JqGrid 的新手,可以指出我的错误吗?
<link type="text/css" href="../jquery-ui-1.9.2.custom/css/ui-lightness/jquery-ui-1.9.2.custom.css" rel="stylesheet" />
<link rel="stylesheet" type="text/css" media="screen" href="../jquery-ui-1.9.2.custom/js/src/css/ui.jqgrid.css" />
<script type="text/javascript" src="../jquery-ui-1.9.2.custom/js/jquery-1.8.3.js"></script>
<script type="text/javascript" src="../jquery-ui-1.9.2.custom/js/jquery-ui-1.9.2.custom.js"></script>
<script src="js/i18n/grid.locale-en.js" type="text/javascript"></script>
<script type="text/javascript" src="../jquery-ui-1.9.2.custom/js/src/jquery.jqGrid.js"></script>
<script type="text/javascript" src="../jquery-ui-1.9.2.custom/js/custom.js"></script>
<script src="../jquery-ui-1.9.2.custom/js/jquery-1.4.2.min.js" type="text/javascript"></script>
<script src="../jquery-ui-1.9.2.custom/js/src/grid.loader.js" type="text/javascript"></script>
这是我的 jquery 代码
jQuery("#jqqGrid").jqGrid({
url: data, // the data is
datatype: 'json',
mtype: 'GET', // tried with POST as well as GET
colNames: ['ID','Name', 'From Date', 'To Date', 'Status'],
colModel: [
{name:'Id', index:'Id', width:55 },
{name: 'name', index:'name', width:90},
{name: 'from_Date', index: 'from_date', width: 90},
{name: 'to_Date', index: 'to_date', width: 90},
{name: 'status', index: 'status', width: 90},
],
rowNumber:10,
sortname: 'emp_Id',
pager: '#jqqGrid_pager',
viewrecords: true,
sortorder:'desc',
caption:'Employee Leave List',
onSelectRow: function(){
var sel = jQuery("#jqqGrid").jqGrid('getGridParam','selrow');
alert(sel);
}
【问题讨论】: