add item into observable array, auto scroll up to top of the page

137 views
Skip to first unread message

ramb...@gmail.com

unread,
Feb 24, 2013, 9:48:24 PM2/24/13
to knock...@googlegroups.com
Hi everyone,

I have create a page to display a list of job requests.
The page only able to display 15 of items, if more than it, it will require user to scroll down to see the other items.
Currently, the list is rendered by using knockoutjs foreach syntax, when user click on "more result" button, it will create another request to server for more records.

When the result came back, it will append into existing array using code below:

$.each(newResult, function (index, item) {
   
self.jobrequests.push(item);
});

The problem:
After finish append into existing observable array, user screen will scroll to the top of the page.
I suspect it is because the "foreach" syntax re-render the whole list.
Is there a better solution than creating a new foreach custom binding?

Thanks

Piotr Stulinski

unread,
Jun 4, 2013, 7:00:18 AM6/4/13
to knock...@googlegroups.com, ramb...@gmail.com
I have the same problem did you find a solution to this?

Ryan Rahlf

unread,
Jun 6, 2013, 10:20:27 AM6/6/13
to knock...@googlegroups.com
What version of Knockout are you using?


--
You received this message because you are subscribed to the Google Groups "KnockoutJS" group.
To unsubscribe from this group and stop receiving emails from it, send an email to knockoutjs+...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

pietrofxq

unread,
Aug 13, 2015, 1:13:53 AM8/13/15
to KnockoutJS, ramb...@gmail.com
Did you find a solution? I'm facing the same problem.
Reply all
Reply to author
Forward
0 new messages