我正在尝试在我的 jqgrid 中实现过滤器工具栏。但是,每当我在任何一个过滤器工具栏搜索框中输入任何内容时,“加载”弹出窗口都会出现并停留在那里,然后什么也没有发生。下面是截图:
下面是我的 jqgrid 代码:
jQuery(document).ready(function($) {
$('#workQueueGrid').jqGrid('GridDestroy');
$("#workQueueGrid").jqGrid({
url:contextRoot+'workQueueGrid',
datatype: 'json',
mtype: 'POST',
colNames: ['ID','Received','Last Name','First Name','Aa','Bbbb', 'Source', 'Ddddd', 'Ccccc', 'Eeeeee', 'Fffffff', 'Ggggggg', 'Hhhhhhh'],
colModel: [
{ name: 'Id', index: 'referralId', width: 30, sortable:true },
{ name: 'receivedDate', index: 'receivedDate', width: 50, formatter: function(cellValue){return $.datepicker.formatDate('mm-dd-yy', new Date(cellValue));}, sortable:true },
{ name: 'lastName', index: 'lastName', width: 55, sortable:true },
{ name: 'firstName', index: 'firstName', width: 55, sortable:true },
{ name: 'data1', index: 'data1', width: 30, sortable:true },
{ name: 'data2', index: 'data2', width: 30, sortable:true },
{ name: 'data3', index: 'data3', width: 40, sortable:true, cellattr: function (rowId, tv, rawObject, cm, rdata) { return 'style="white-space: normal;"'; } },
{ name: 'data4', index: 'data4', width: 30, sortable:true, cellattr: function (rowId, tv, rawObject, cm, rdata) { return 'style="white-space: normal;"'; } },
{ name: 'data5', index: 'data5', width: 40, sortable:true, cellattr: function (rowId, tv, rawObject, cm, rdata) { return 'style="white-space: normal;"'; } },
{ name: 'data6', index: 'data6', width: 50, formatter: function(cellValue){return $.datepicker.formatDate('mm-dd-yy', new Date(cellValue));}, sortable:true },
{ name: 'data7', index: 'data7', width: 50, formatter: function(cellValue){return $.datepicker.formatDate('mm-dd-yy', new Date(cellValue));}, sortable:true },
{ name: 'data8', index: 'data8', width: 50, formatter: function(cellValue){return $.datepicker.formatDate('mm-dd-yy', new Date(cellValue));}, sortable:true },
{ name: 'data9', index: 'data9', width: 80, sortable:true, cellattr: function (rowId, tv, rawObject, cm, rdata) { return 'style="white-space: normal;"'; } }
],loadError: function(xhr,st,err) {
alert(err);
},onSelectRow : function(rowid, status, e) {
var selRow = $(this).getGridParam("selrow");
var selReferralId = $(this).getCell(selRow, 'referralId');
window.location = (contextRoot+"referralDetails?refId=" + selReferralId );
},
jsonReader: {
repeatitems: false,
},
pager: '#workQueuePager',
sortname: 'receivedDate',
sortorder: 'desc',
gridview: true,
viewrecords: true,
loadonce: true,
autowidth: true,
shrinkToFit: true,
height: 'auto',
rowNum: 12,
ignoreCase: true,
altRows:true
});
$("#workQueueGrid").jqGrid('navGrid','#workQueuePager',
{
edit:false,
add:false,
del:false,
search:false,
refresh:false
});
$("#workQueueGrid").jqGrid('filterToolbar',
{
stringResult: true,
searchOnEnter: false,
defaultSearch: "bw"
});
});
样本数据:
{"rows":[{"receivedDate":1357016400000,"referralId":23450,"lastName":"Smith","firstName":"John","goCode":"A99","zoneCode":"NE","sourceName":"Source Name","status":"Pending","actionAS":"AS Action","vpReportDate":1357016400000,"approvedDate":1357016400000,"lastModifiedDate":1357016400000,"workflow":"Recommendation(s) required"},{"receivedDate":1357102800000,"referralId":23451,"lastName":"Smith","firstName":"John","goCode":"A99","zoneCode":"NE","sourceName":"Source Name","status":"Pending","actionAS":"AS Action","vpReportDate":1357102800000,"approvedDate":1357102800000,"lastModifiedDate":1357102800000,"workflow":"Recommendation(s) required"},{"receivedDate":1357189200000,"referralId":23452,"lastName":"Smith","firstName":"John","goCode":"A99","zoneCode":"NE","sourceName":"Source Name","status":"Pending","actionAS":"AS Action","vpReportDate":1357189200000,"approvedDate":1357189200000,"lastModifiedDate":1357189200000,"workflow":"Recommendation(s) required"},
不确定,我在这里错过了什么?!?
更新1:
Below is the error I'm getting:
Uncaught TypeError: Cannot call method 'getAccessor' of undefined
更新 2
下面是 JSP:
<%@ taglib prefix="spring" uri="http://www.springframework.org/tags" %>
<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<html>
<head>
<script type="text/javascript" src="<c:url value="/js/workQueue.js"/>"></script>
<style type="text/css">
th.ui-th-column div {
white-space:normal !important;
height:auto !important;
padding:2px;
}
</style>
</head>
<body>
<table width="100%">
<tr>
<td>
<span style="font-size: 18px"><b>${status == 'pending' ? 'Pending': 'Approved'}</b></span><br/><br/>
There are ${workQueueCount} referrals ${status}. Click a row to see details.<a href="<c:url value="/excelExport"/>" id="excelExport" style="float: right;">Export To Excel</a>
</td>
</tr>
<tr height="5px">
<td>
</td>
</tr>
<tr>
<td>
<table id="dartWorkQueueGrid"></table>
<div id="dartWorkQueuePager"></div>
</td>
</tr>
</table>
</body>
</html>
这是处理程序方法:
@RequestMapping(method = RequestMethod.POST, value = "/workQueueGrid")
@ResponseBody
public JqgridResponse loadWorkQueue() {
this.referrals = dartService.getReferralCases(status);
JqgridResponse response = new JqgridResponse();
response.setRows(referrals);
return response;
}
这是 JqgridResponse.java:
package com.nyl.corp.disciplinaryactions.web;
import java.util.List;
public class JqgridResponse {
public JqgridResponse(List<?> rows) {
this.rows = rows;
}
public JqgridResponse() {
}
private List<?> rows;
private int page;
private int total;
private int records;
public void setRows(List<?> rows) {
this.rows = rows;
}
public List<?> getRows() {
return rows;
}
public int getPage() {
return page;
}
public void setPage(int page) {
this.page = page;
}
public int getTotal() {
return total;
}
public void setTotal(int total) {
this.total = total;
}
public int getRecords() {
return records;
}
public void setRecords(int records) {
this.records = records;
}
}
更新 3 选项卡内网格的快照:
更新 4 个 标签 JSP 代码:
<script>
$(function() {
$( "#workQueuesTab" ).tabs();
});
</script>
</head>
<body>
<div style="width:95%" id="workQueuesTab">
<ul>
<li><a href="<c:url value="/workQueue/pending"/>">Pending</a></li>
<li><a href="<c:url value="/workQueue/approved"/>">Approved</a></li>
<li><a href="<c:url value="/workQueue/additionalSteps"/>">Additional Steps</a></li>
</ul>
</div>
</body>