-
Notifications
You must be signed in to change notification settings - Fork 107
index count plus direction for cursor based scrolling #63
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
One way of doing it is to use get signature with the descriptor |
Hi, thanks, not sure how to do that - can you send a couple line example? Here's what I have so far, for anyone else too - who is looking to do cursor wise scrolling to rest api as I am. The weird thing that I found is that the adapter topVisibleScope.$index is undefined until it gets created by the adapter. And the other issue is being called twice at start up for negative direction by design, here's how I handled direction (isForward (bool)) and startup. This looks promising but wondering if anyone has any better ideas? Basically all the magic happens at loadFeedCursor with count, mad_id and since_id.
|
Your code shows one way of doing this. Here is something to illustrate another:
As side note - there is no need for calling success from a $timeout. I used it in the examples to emulate the network asynchronicity |
ah, thanks Michael, I was just reading the doc on this, I don't know how I missed the append, prepend direction. I love it. In my testing now the back end is all set but the front end keeps calling me with index 1, count over and over and I'm returning the right items, so I need to look now. Once I get this working, I'll share here - maybe be a good example for cursor based scrolling. |
So thanks for your help! I got this to work much better now! The only issue left is that I noticed with smaller buffer-size of say 5 and about 6 posts per page, I sometimes see jittery or infinite looping where it bounces back and fourth. I raised buffer to 10 and seems better. The replace it not perfect. There's still some scrolling mis-placement (but could be something i'm not doing). Question - does this require fixed size Here's the final code, still with timeout but I'll remove that. So much easier. thanks!
|
first of all there is no need to funnel it through $timeout. Just put the insides of the anonymous function directly in the get method. As I said, the $timeout in the examples are only to pretend that the data are accessed asynchronously over the net. In real life there is no need to pretend. As to the size - as long as your items are block items you should be fine. Inline items can give you headaches though. Also be careful; |
thanks Michael. Append is undefined at start right, so my if test will fail, I default to count only when at start. I now pass max_id xor since_id to my rest api. Seems like that is working well. My invariant is that a valid append/prepend will always point to an item, which is used to get the activity id. Therefore in effect, the id is the max/since id - I don't need to save them anywhere. |
@MartyBolton With |
Hi, I know you talked about cursor based scrolling before and to some extent this is up to the datasource but I'm wondering... is there an easy way to figure out direction? This way, I know to use a cursor based feed like twitter's max_id and since_id or other cursor based ids to go off and fetch dynamic feed data based on a cursor. So, being new to ui-scroll can you point me to how I can get direction from the next datasource get event? Or have you considered adding this? Basically, I'm thinking I use the direction to know if I should get next set of results or previous. I guess I can use the topvisible and do math on the index or something, hoping you can show me valid syntax to calculate direction. What can I do in my get to calculate the direction you think?
thanks
Marty
The text was updated successfully, but these errors were encountered: