在需要加入inger表格的页面中加入:
后台处理之后返回的Json类容格式
/*页面接受的格式,必须如下
{"rows":[
{"id":"11","cell":["111","2222 ","3333","444"]},{"id":"22","cell":["555","6666","7777","8888"]}
],
"records":"619","page":"3","total":"31"
}
*/
<script type="text/javascript" language="javaScript" src="jquery-1.6.2.js"></script>
<script jquery.ingrid.js"></script>
<link href="ingrid.css" type="text/css" rel="stylesheet">
//定义表格变量
var searchGrid;
//begin ready
$(document).ready(function() {
//初始化表格
searchGrid = jQuery("#dataTable").ingrid({
url:'produceService.jsp',
height: 300,
width:1080,
resizableCols:false,
dataType:'json',
colWidths: [500,500],
formatter :['',''],
rowClasses: ['grid-row-style1'],
customCols : [0],
onRowSelect: function(tr, selected){
if(selected){
selectedRow =tr;
}else{
selectedRow="";
}
},
onDblClick: function(tr, selected){
}
});
});
//Get the search criteria
function getFilter(){
var filter =
{
serviceType : "queryByKeyWord",
keywordSearch : $("#keywordSearch").val(),
page:1,
recordsPerPage:searchGrid.g.cfg.recordsPerPage
}
return filter;
}
后台处理之后返回的Json类容格式
/*页面接受的格式,必须如下
{"rows":[
{"id":"11","cell":["111","2222 ","3333","444"]},{"id":"22","cell":["555","6666","7777","8888"]}
],
"records":"619","page":"3","total":"31"
}
*/