Reputation: 15035
I have a very long table. The first column of each one of the rows is an <a>
tag. A click on an <a>
tag does:
route
and page reloads
<a>
tag<a>
tag.The length of the data differs from each other. At a time, I only show data related to one of the <a>
tags. For instance, a click on the first <a>
displays data related to it just after of it. A click on the second <a>
shows data related to it and hides data related to the first <a>
.
<a>
tag you clicked on when route changes and page reloads?If you answer, please no jQuery.
Upvotes: 1
Views: 72
Reputation: 1019
So what's inside your tables? Is it images?
And the "data from the server", is it data, like data from an api request? Or is it a new webpage?
If we're talking a dynamic web page here. I remember dealing with the same problem with an infinite scroll view where a user clicks an element, and then goes back and expects to return on the same position.
The problem with dynamic content is that it takes a while for the browser to render it. Depending on what it is it might take a few milliseconds to many seconds (poor 3G and a view with 1000 images for instance). And while this rendering is going on, you never really know where the scroll should end up. It is possible to solve by adding timeouts and adjusting the scroll until we're almost sure that the page is in the correct place. But it's usually a mess.
You say that the page reloads? Normally a page needs to "reload" if a user is changing route and similar. If the data you are loading is a new page, the I get why you have to reload. But if it's an api request for some other data; is it an option to not reload the page? If that's possible, then you could remove and add elements instead of reloading the entire page.
Upvotes: 1