1. Roland Smith
  2. PowerBuilder
  3. Thursday, 14 November 2019 20:49 PM UTC

I'm wondering if there is a way to tell when the user has scrolled down to the bottom of the resultset.

 

Miguel Leeuwe Accepted Answer Pending Moderation
  1. Sunday, 17 November 2019 01:28 AM UTC
  2. PowerBuilder
  3. # 1

Hi,

My humble opinion on this: I think (without trying) that, when using "retrieve-rows as needed" your dw_1.RowCount() is always only going to report the amount of rows retrieved "so far".

I'm not sure about Scrollpositions, like Ren'e says, it's definitely worth a try, but ... based upon vague memories to the last time I used it, I think the simplest solution would be to check on whether the last-visible-row equals a previously read value of select count(*) with embedded SQL. (previous to having done retrieve and adding or deducing insertrows, importrows, delete rows, etc).

If you have lots of these dw's,  you could bake this select count() into the sqlPreview event, but you'd still have to sum and detract values when inserting and deleting rows. If that's too complicated or messy, you could also opt for doing the select count in the scroll event itself, but only when the lastvisible row = the this.RowCount() and then do the SELECT count() check to see if it's "really the end". :)

Most probably the scroll event isn't even fired anymore, once you've really scrolled down to the last possibly retrieved row. I'm not sure if there's something like a ScrollOut event like there's tabout for tabbing.

 

Comment
  1. Roland Smith
  2. Monday, 18 November 2019 13:43 PM UTC
Thanks for all the ideas. My use case is a dropdown datawindow for name search. User types in the field and then in code the SQL of the DataWindowChild is modified and it is retrieved. Because there could be thousands of matches, it uses RowsAsNeeded.
  1. Helpful
  1. Miguel Leeuwe
  2. Monday, 18 November 2019 13:50 PM UTC
It sound a lot like what the pfc's do with the simple filter window. I guess you've seen that one. In that case, what I would do, is an initial full retrieve of the child dddw and apply filters on it as the user goes typing. So not using retrieve as needed and not modiying the sql on every keystroke.

HIH.
  1. Helpful
  1. Miguel Leeuwe
  2. Monday, 18 November 2019 13:56 PM UTC
Or .... as long as the "user is typing", use your method of retrieve as needed, but AS SOON as the user "starts" scrolling down (check on dddw rowfocuschanged and scrollevent of the dddw), change the "retrieve as needed" to "not" retrieve as needed and do a last full modification of the sql and last retrieve based on the current text typed in. (something like that).. I the user changes the text again by editing, go back to the initial situation of retr. as needed.

:s
  1. Helpful
There are no comments made yet.
René Ullrich Accepted Answer Pending Moderation
  1. Friday, 15 November 2019 08:11 AM UTC
  2. PowerBuilder
  3. # 2

Hi Roland,

another way is to compare the current scroll position to the maximum scroll position.

The current scroll position you find in parameter scrollpos in scrollvertical event or you use Describe("DataWindow.VerticalScrollPosition").

The maximum scroll position you get with Describe("DataWindow.VerticalScrollMaximum").

HTH,

René

Comment
There are no comments made yet.
Chris Pollach @Appeon Accepted Answer Pending Moderation
  1. Thursday, 14 November 2019 21:39 PM UTC
  2. PowerBuilder
  3. # 3

Hi Roland;

   I have not tried this but what about comparing RowCount() to the DC's "LastRowOnPage", as follows ...

 ls_row = DC.Describe("DataWindow.LastRowOnPage")

IF Long (ls_row) = RowCount() THEN

  // END of rs - do something

END IF

HTH

Regards ... Chris

Comment
There are no comments made yet.
  • Page :
  • 1


There are no replies made for this question yet.
However, you are not allowed to reply to this question.
We use cookies which are necessary for the proper functioning of our websites. We also use cookies to analyze our traffic, improve your experience and provide social media features. If you continue to use this site, you consent to our use of cookies.