Comments (15)
I've just browsed the code and found out that there is a check, which ignores applyUpdate
after the current buffer. I'm referencing to this line of code (line 462). This may work while the user didn't scroll to the EOF, but it won't work if there is something appended after the old EOF. How can I tell ui-scroll
that the EOF has been moved?
- Maybe just adding an
else
statement to that line which setsEOF
to false may help? *
from ui-scroll.
You have to replace the last item with an array of 2 items - the last one
followed by the new one. I will put together an example later
On Wed, Jul 15, 2015 at 4:24 PM, Michael Hohl [email protected]
wrote:
I've just browsed the code and found out that there is a check, which
ignores applyUpdate after the current buffer. I'm referencing to this
line of code (line 462).
https://github.com/angular-ui/ui-scroll/blob/master/src/ui-scroll.coffee#L462
This may work while the user didn't scroll to the EOF, but it won't work if
there is something appended after the old EOF. How can I tell ui-scroll
that the EOF has been moved?—
Reply to this email directly or view it on GitHub
#4 (comment).
from ui-scroll.
Thank you. It seems that this works out and is enough for my case. However it may be more user-friendly if this would be handled by the library.
from ui-scroll.
Adding
else if arg1-first == buffer.length
applyUpdate buffer[arg1 - 1 - first], [buffer[arg1 - first].scope[itemName], arg2]
for example does the job quite well.
from ui-scroll.
I understand your point but I wonder if this just opens a can of worms. What should happen if the index is buffer.length + 1, or +2? how should I handle index -1 etc.
May be I should define an additional methods - append and prepend?
from ui-scroll.
I would prefer explicit methods „append“ and „prepend“.
Am 16.07.2015 um 14:02 schrieb Michael Feingold [email protected]:
I understand your point but I wonder if this just opens a can of worms. What should happen if the index is buffer.length + 1, or +2? how should I handle index -1 etc.
May be I should define an additional methods - append and prepend?—
Reply to this email directly or view it on GitHub #4 (comment).
from ui-scroll.
like
adapter.append = function (arg) {
dismissPendingRequests();
applyUpdate(buffer[buffer.length - 1], [buffer[buffer.length - 1].scope[itemName], arg]);
return adjustBuffer(ridActual);
};
but maybe with additional check if EOF is reached?
from ui-scroll.
adapter.append = function (arg) {
dismissPendingRequests();
applyUpdate(buffer[buffer.length - 1], [buffer[buffer.length - 1].scope[itemName], arg]);
return adjustBuffer(ridActual);
};
This works quite well for me, but when the buffer is empty there are issues.
from ui-scroll.
Just pushed a version with implemented append/prepend methods on the adapter. I put it in the 'append' branch for now because I did not really test it. Let me know if it works for you.
Keep in mind that animation will not be applied to elements inserted with append/prepend
from ui-scroll.
I just tried the new append
method and it is working fine on both empty and non-empty buffers. Thanks for adding it. I had been using a variable to keep track of the last index in the datasource in order to do call applyUpdates
on the last index to append, and now that isn't needed anymore.
from ui-scroll.
@compact do you use animation for your updates?
from ui-scroll.
No, I don't.
from ui-scroll.
@hohl check out the append method I just added to the adapter
from ui-scroll.
Looks like everything works fine. Thanks!
Am 21.07.2015 um 16:08 schrieb Michael Feingold [email protected]:
@hohl https://github.com/hohl check out the append method I just added to the adapter
—
Reply to this email directly or view it on GitHub #4 (comment).
from ui-scroll.
And now - does any easy method to scroll to the latest position exists?
from ui-scroll.
Related Issues (20)
- isElementVisible performance HOT 4
- The scrollbar-thumb height doesn't affect the number of existing elements HOT 2
- adapter reload() re-render the DOM even items are the same. HOT 11
- keyboard scrolling gets stuck when the focused element get destroyed HOT 5
- Unpaired bindEvent/unbindEvent with reload() HOT 4
- Dealing with updates. Is it possible not to touch min index? HOT 4
- Issue when batch applyUpdates() HOT 2
- Buffer index when deleting an item HOT 2
- Get DOM element at index HOT 3
- Is the .idea directory intentionally published in npm HOT 2
- reload() causes lost of scroll thumb size HOT 5
- Different uiScrollViewport schemes when using as a component HOT 4
- Trying to understand enqueueFetch logic (unable to fetch data in window list) HOT 1
- bind/unbind is deprecreated HOT 2
- Sticky Headers HOT 2
- Height doesn't reset correctly on scroll top HOT 4
- Many ng-scroll on the page with different datasources HOT 4
- Flicker effect on reloading datasource on keypress serach HOT 1
- The v1.9.0 doesn't work with ES5 HOT 1
- How not to fetch invalid page if the total number of valid pages are already known ? HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from ui-scroll.