DOM看起来像这样:
<div class="ui-jqgrid-dbiv" style="width:998px; height:200px">
<div style="height:1151702px; position:relative">
<div style="height:680800px;">
看起来jqGrid API正在导致它。我们将scroll设置为true,即打开虚拟分页。在某些情况下,网格中会填充几行,在DOM检查中我们会看到这些副作用。有没有JQGrid经验的人解释发生了什么以及如何解决这个问题!
jQuery(document).ready(function() {
jQuery('#ContentPanel1__01TestCustomerList').jqGrid(
{
datatype:function(postdata) {
$('#ContentPanel1__01TestCustomerList').listContentPart('getData', postdata); },
page: 1,
colNames: ["A/C Ref","Name","Short Name","Credit Limit"],colModel: [{"classes":"sage200-gridCell","name":"CustomerAccountNumber","index":"CustomerAccountNumber","formatter":DefaultFormat,"unformat":unformatField,"searchoptions":{"attr":{"title":"contains"},"sopt":["eq","ne","cn","nc","bw","bn"]}},{"classes":"sage200-gridCell","name":"CustomerAccountName","index":"CustomerAccountName","formatter":DefaultFormat,"unformat":unformatField,"searchoptions":{"attr":{"title":"contains"},"sopt":["eq","ne","cn","nc","bw","bn"]}},{"classes":"sage200-gridCell","name":"CustomerAccountShortName","index":"CustomerAccountShortName","formatter":DefaultFormat,"unformat":unformatField,"searchoptions":{"attr":{"title":"contains"},"sopt":["eq","ne","cn","nc","bw","bn"]}},{"classes":"sage200-gridCell","name":"CreditLimit","index":"CreditLimit","formatter":CurrencyFormat,"unformat":unformatField,"searchoptions":{"attr":{"title":"equals"},"sopt":["eq","ne","lt","le","gt","ge"]}}],
viewrecords: true,
scrollrows: false,
prmNames: { id: "CustomerAccountNumber" },
shrinkToFit: false,
pager: jQuery('#ContentPanel1__01TestCustomerList_pager'),
onSelectRow: function (a,b) { OnRowSelect('ContentPanel1__01TestCustomerList', a, b); },
ondblClickRow: function (event){ GridDoubleClick(event.target); },
loadError: jqGrid_aspnet_loadErrorHandler,gridComplete: function () { $("#ContentPanel1__01TestCustomerList").listContentPart("onInit"); },
resizeStop: function(newWidth, index) { $("#ContentPanel1__01TestCustomerList").listContentPart("onColumnResize", newWidth, index); },
hoverrows: false,
scroll: 1,
rowNum: 25,
rowList: [10,20,30],
editDialogOptions: {"recreateForm":true,errorTextFormat:function(data) { return 'Error: ' + data.responseText },editData:{ __RequestVerificationToken: jQuery('input[name=__RequestVerificationToken]').val() }},addDialogOptions: {"recreateForm":true,errorTextFormat:function(data) { return 'Error: ' + data.responseText },editData:{ __RequestVerificationToken: jQuery('input[name=__RequestVerificationToken]').val() }},delDialogOptions: {"recreateForm":true,errorTextFormat:function(data) { return 'Error: ' + data.responseText },delData:{ __RequestVerificationToken: jQuery('input[name=__RequestVerificationToken]').val() }},searchDialogOptions: {onReset:ContentPanel1_onReset,"multipleSearch":true,"sFilter":"ObeyOperatorFilters",onInitializeSearch:ContentPanel1_onInitializeSearch,afterRedraw:ContentPanel1_afterRedraw,"modal":true,"Find":"Apply",onSearch:ContentPanel1_onSearch,"width":600,beforeShowSearch:ContentPanel1_beforeShowSearch,"recreateForm":true,"caption":"Advanced Filter"},jsonReader: {id:"id",page:function (obj) { return obj.page; },root:function (obj) {return obj.$resources;},records:function (obj) { return obj.$totalResults;},total:function (obj) { return obj.total; },repeatitems:false},sortorder: 'asc',multiselect: true,width: '250',height: '200',viewsortcols: [false,'vertical',true]})
.navGrid('#ContentPanel1__01TestCustomerList_pager',{"edit":false,"add":false,"del":false,"search":true,"refresh":true,"view":false,"position":"left","cloneToTop":true},jQuery('#ContentPanel1__01TestCustomerList').getGridParam('editDialogOptions'),jQuery('#ContentPanel1__01TestCustomerList').getGridParam('addDialogOptions'),jQuery('#ContentPanel1__01TestCustomerList').getGridParam('delDialogOptions'),jQuery('#ContentPanel1__01TestCustomerList').getGridParam('searchDialogOptions') );
function jqGrid_aspnet_loadErrorHandler(xht, st, handler) {jQuery(document.body).css('font-size','100%'); jQuery(document.body).html(xht.responseText);};});