我正在尝试实现主要详细示例(http://trirand.com/blog/jqgrid/jqgrid.html)。我可以加载数据,但'#pager10'只显示第一页。我可以更改行号,但即使单击下一步按钮也无法加载其他页面。我试过'loadonce:true'以及'false'选项。这是jquery脚本。
jQuery(function($) {
var data= $('#abcd').text();
var data= data.replace(/[\“\”\″]/ig,'\"');
var data = jQuery.trim(data);
var title = $('#title_for_table').text();
var title = jQuery.trim(title);
if(title=="Sequencing")
{
jQuery('#genotype').show();
jQuery("#tableid").jqGrid({
datatype: "jsonstring",
datastr:data,
colNames:['genotype','num_of_variants' ],
colModel:[
{name:'genotype',index:'genotype', width:300},
{name:'num_of_variants',index:'num_of_variants', width:300}
],
pager: '#pager',
rowNum:50,
rowList:[25,50,75,100],
sortname: 'genotype',
sortorder: "asc",
viewrecords: true,
gridview: true,
height: '250px',
width: '100%',
caption:title+" Search Results",
onSelectRow: function(genotype) {
if(genotype == null) {
genotype=0;
if(jQuery("#list10_d").jqGrid('getGridParam','records') >0 ) {
jQuery("#list10_d").jqGrid('setGridParam',{url:"simple3.php?genotype="+genotype,page:1});
jQuery("#list10_d").jqGrid('setCaption',"SNPs of genotype: "+genotype) .trigger('reloadGrid'); }
}
else {
jQuery("#list10_d").jqGrid('setGridParam',{url:"simple3.php?genotype="+genotype,page:1});
jQuery("#list10_d").jqGrid('setCaption',"SNPs of genotype: "+genotype) .trigger('reloadGrid');
}
},
});
jQuery("#list10_d").jqGrid({
url:'simple3.php?genotype='+genotype,
datatype: 'JSON',
mtype:'POST',
colNames:['SNP id','chromosome','start position','End position','class','reference base','variant base'],
colModel:[
{name:'snp_id',index:'snp_id', width:100},
{name:'chr',index:'chr', width:100},
{name:'start_pos',index:'start_pos', width:150},
{name:'end_pos',index:'end_pos', width:150},
{name:'clas',index:'clas', width:150, },
{name:'refbase',index:'refbase', width:150},
{name:'variantbase',index:'variantbase', width:150}
],
rowNum:50,
rowList:[50,100,200],
pager:jQuery('#pager10'),
sortname: 'snp_id',
height: '400px',
width: '100%',
viewrecords: true,
gridview: true,
sortorder: "asc",
caption:"SNPs of genotypes:" });
}
});