问题
How to use JScrollPane with jqgrid? I tried to use it but the headers are not moving. Here is my code.
gridComplete:function(){
$('#gview_mygrid >div.ui-jqgrid-bdiv').jScrollPane({ showArrows: true, scrollbarWidth: 17, arrowSize: 17, scrollbarMargin: 0 });}
回答1:
Finally I figured it out.. Here is the working code. In the markup
<div id="container" >
<table id="list"><tr><td/></tr></table>
<div id="pager"></div>
</div>
IN Java script, We have to bind the header (class .ui-jqgrid-hbox) also to scroll
gridComplete:function(){
var table_header = $('#container').find('.ui-jqgrid-hbox').css("position","relative");
$('#container').find('.ui-jqgrid-bdiv').bind('jsp-scroll-x', function(event, scrollPositionX, isAtLeft, isAtRight) {
table_header.css('right', scrollPositionX);
}).jScrollPane({
showArrows: true,
autoReinitialise: true,
horizontalDragMaxWidth: 30,
verticalDragMaxHeight: 30
});
}
来源:https://stackoverflow.com/questions/13505536/how-to-use-jscrollpane-with-jqgrid