Author Topic: maintain scroll position?  (Read 2376 times)

arborresearch

  • Pro Ultimate
  • Newbie
  • *
  • Posts: 6
    • View Profile
maintain scroll position?
« on: February 21, 2017, 09:54:37 pm »
Sirs, Ma'ams,


As far as I can tell, it looks like there are two options for managing scroll position within a grid.

1. use the rowIndx (get/set)
 $("#selector").pqGrid("scrollRow", { rowIndxPage: 10 });  //[10 = or whatever row you want]

2. locate the scrollbar object - set the cur_pos option.
$( ".selector" ).pqScrollBar( "option", "cur_pos", 300 ); //[300 - or whatever position you want]


As far as I can tell, option 2 above doesn't seem to work.
Also, obtaining the scroll position is also ignored: - var cur_pos = $( ".selector" ).pqScrollBar( "option", "cur_pos" );
This is taken from here: https://paramquery.com/api/scrollbar

Option 1 requires knowing what rowindex they are interested in - no easy feat unless they tell you in other ways than simply scrolling.
One can maintain the chosen index if they select a row, but if they are just scrolling - all bets are off.


I'd like to be able to assist the visitor by returning them to the previous scroll position after returning to the page.
Have you any hints that could assist me in accomplishing this?

Thanks in advance!





paramvir

  • Administrator
  • Hero Member
  • *****
  • Posts: 6309
    • View Profile
Re: maintain scroll position?
« Reply #1 on: February 21, 2017, 11:08:08 pm »
Option 2 works too. cur_pos could be saved at time of grid destroy and restored at time of grid complete event.

Please check this example, it uses cur_pos: https://paramquery.com/pro/demos/scroll

arborresearch

  • Pro Ultimate
  • Newbie
  • *
  • Posts: 6
    • View Profile
Re: maintain scroll position?
« Reply #2 on: February 22, 2017, 01:36:59 am »
Nice!  :D

I'll take a look at the code on the dependent scrolling table page.