Maintain vertical Scroll bar

QuestionsMaintain vertical Scroll bar
Hussein Alaedin asked 6 years ago

Hello,
Can the phpgrid vertical scroll bar maintain its position when the grid
autorefreshed by setTimeout("jQuery('#list1').trigger('reloadGrid',[{page:1}]);",1000);?

Thanks in advanced.
H.A

4 Answers
Abu Ghufran answered 6 years ago

Hi,

This is doable but need to override loadcomplete event.
working sample is here.

http://www.phpgrid.org/demo/demos/misc/keep-vertical-scroll.php

<script>
function do_onload()
{
if (jQuery(window).data('phpgrid_scroll'))
jQuery('div.ui-jqgrid-bdiv').scrollTop(jQuery(window).data('phpgrid_scroll'));

setTimeout("jQuery(window).data('phpgrid_scroll',jQuery('div.ui-jqgrid-bdiv').scrollTop()); jQuery('#list1').trigger('reloadGrid',[{jqgrid_page:1}])",3000);
}
</script>

Abu Ghufran answered 6 years ago

btw, the event controlling is currently part of licensed version (unless you find some hack in free build)

Chris Henderson answered 6 years ago

Abu,

This works great, but, if you have selected (ticked) some of the rows they get de-selected every time the timeout occurs…

Any ideas?

Chris

Abu Ghufran answered 6 years ago

I've updated the demo on website and emailed you updated grid sample code.
http://www.phpgrid.org/demo/demos/misc/keep-vertical-scroll.php

Your Answer

4 + 3 =

Login with your Social Id:

OR, enter

Attach code here and paste link in question.
Attach screenshot here and paste link in question.



How useful was this discussion?

Click on a star to rate it!

Average rating / 5. Vote count:

We are sorry that this post was not useful for you!

Let us improve this post!