Something like an Anchor...

Something like an Anchor...

  
Hi, I have a screen, with a table records which has buttons in each line....

Each button executes an action and returns to the same screen...

The problem is the page goes back to top, and i need it to load where people clicked, so it is more user friendly.

I was thinking in somehow create an anchor when someone clicks and then, when loading the page, just load it on the previous created anchor...But i'm not quite sure how to do this...

Anyone has any suggestions?

Best Regards,

Diogo C S Cordeiro
Hi Diogo,

If you are using the .NET version of the OutSystems Platform you can call the MaintainScrollPositionOnPostback action in the attached extension at the preparation of your web screen. This extension action has a single line of code:
AppInfo.GetAppInfo().OsContext.CurrentScreen.MaintainScrollPositionOnPostBack = true;
Hope this helps,
Tiago Simões
Thank You Tiago....

I'll take a look into the way extensions are built so i may try to make my own extensions...


(It suited me fine)

Best Regards,

Diogo C S Cordeiro
Hello Tiago,

this is exactly what I need.
Only we are using the 4.0.x version of the outsystems products.
So I made a new extension and copied your line of code, but the MaintainScrollPositionOnPostBack property does not exists. Is this only available in the 4.1.x versions?
If so, is there another way to solve this problem?

Regards, Emilio
Hi Emilio,

You are right, that is only available in ASP.NET 2.0.
But you can achieve the same results using javascript as you can check on this post about keeping scroll position after a postback

Cheers,
Tiago Simões
Hi,
I was using this extension on firefox, and it was working fine. But now I'm testing in Internet explorer and it doesn't work.
Is this normal?
Hi Francisco,

It should work in IE. This is a built-in ASP.NET action. If the extension is not working correctly you can also try this script.

Cheers,
Tiago Simões
Hi,

I built a new espace to check if the maintainscrollpositionafterpostback worrked on a raw espace, and it worked...

I tried the other script too, and it didn't work either...

Can it be because I'm using tabs?
It should be probably because of tabs.

Now MaintainPostBackPosition is working.

ut is there a way to maintain post back position if we call Current screen?
Sorry, I ment MaintainScrollPositionOnPostback
Hi Francisco,

Maybe you can try to use the script in this post: Keeping scroll position after a postback (not sure if it works with tabs thought).

Cheers,
Tiago Simões
None of the solutions work with tabs...
Hi,

I don't know if this will work with tabs, but you can try this script. You should add its content to an unescaped expression, at the screen position you want to scroll when the page loads.

<a name='MyAnchor'>
<script language='javascript' type='text/javascript' defer>
try {
document.location = '#MyAnchor';
}
catch (e) {Error=e;}
</script>
Hey,

I forgot to reply. This last solution didn't work either. It breaks the tab where the anchor is.

Thank's though.

FN