Giter Club home page Giter Club logo

Comments (15)

hohl avatar hohl commented on August 21, 2024

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 sets EOF to false may help? *

from ui-scroll.

mfeingold avatar mfeingold commented on August 21, 2024

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.

hohl avatar hohl commented on August 21, 2024

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.

hohl avatar hohl commented on August 21, 2024

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.

mfeingold avatar mfeingold commented on August 21, 2024

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.

hohl avatar hohl commented on August 21, 2024

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.

hohl avatar hohl commented on August 21, 2024

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.

hohl avatar hohl commented on August 21, 2024
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.

mfeingold avatar mfeingold commented on August 21, 2024

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.

compact avatar compact commented on August 21, 2024

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.

mfeingold avatar mfeingold commented on August 21, 2024

@compact do you use animation for your updates?

from ui-scroll.

compact avatar compact commented on August 21, 2024

No, I don't.

from ui-scroll.

mfeingold avatar mfeingold commented on August 21, 2024

@hohl check out the append method I just added to the adapter

from ui-scroll.

hohl avatar hohl commented on August 21, 2024

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.

studentIvan avatar studentIvan commented on August 21, 2024

And now - does any easy method to scroll to the latest position exists?

from ui-scroll.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.