Maintain vertical Scroll bar

QuestionsMaintain vertical Scroll bar
Hussein Alaedin asked 11 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 11 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 11 years ago

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

Chris Henderson answered 11 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 11 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

15 + 20 =

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 0 / 5. Vote count: 0

No votes so far! Be the first to rate it.

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

Let us improve this post!

Tell us how we can improve this post?