Author Topic: Scroll with tailing the grid  (Read 2515 times)

rushabhwadkar

  • Newbie
  • *
  • Posts: 7
    • View Profile
Scroll with tailing the grid
« on: February 03, 2020, 12:02:45 pm »
I want to implement a tailing feature in PQ Grid (Virtual X and Y set to true).

So, If the user is at the top then the scroll should not move but if the user is at the bottom (i.e. at the last row) then scroll should be updated to the latest row added as and when. What can be the best way to implement this?

I tried using the getRowsByClass which will return the array and then I would get the last row out of it and respectively scroll to that row. However, the below code is not returning anything. Please help with this too -
Code: [Select]
$("#logOutputGrid").pqGrid("getRowsByClass", { cls: 'pq-grid-row'})

paramvir

  • Administrator
  • Hero Member
  • *****
  • Posts: 6310
    • View Profile
Re: Scroll with tailing the grid
« Reply #1 on: February 04, 2020, 09:58:06 am »

rushabhwadkar

  • Newbie
  • *
  • Posts: 7
    • View Profile
Re: Scroll with tailing the grid
« Reply #2 on: February 04, 2020, 12:19:15 pm »
No. You got me wrong.

You provided with infinite scrolling which is perfect. However, I want the scroll bar to go the bottom automatically as and when a new row gets added (Only when the user is at the bottom).

Use Case (1M rows):
1. When user is at the top and a new row gets added - It must remain at that position.
2. When user is at the bottom i.e at the last row for current data and a new row gets added(or new rows get added) - It must scroll down automatically to the new row just like tailing the rows.

My Question is - Do we have an API which can fetch at what position or at which rowIndx the scrollbar is / pointing at?

paramvir

  • Administrator
  • Hero Member
  • *****
  • Posts: 6310
    • View Profile
Re: Scroll with tailing the grid
« Reply #3 on: February 04, 2020, 12:46:11 pm »
There is event beforeTableView in grid

https://paramquery.com/api#event-beforeTableView

and option cur_pos in scrollbar.

https://paramquery.com/api/scrollbar#option-cur_pos

Either one or both of them may help you to extract the required information.