CGDevTools Forum

Welcome to the Official CGDevTools Support Community Forums.

RenderRegionAsync with same scroll position

by George » 20 Oct 2015 13:01

Hello!

I'm interesting is there a predefined feature to RenderRegionAsync that was rendered and scrolled previously, but without position loss? My tricky approach not work anymore with chrome, since it was updated.
Best regards!
George
 
Posts: 486
Joined: 23 May 2013 15:50
Location: Russia, Moscow

by Alexander Bulei » 21 Oct 2015 09:40

Hi George,

Don't sure if it will work, but you can try:

On event with AjaxReRender add browser parameter and save the current position of scroll, then on AjaxReRender, you have 3rd parameter AAfterLazyLoadJS, add the javascript code to scroll to saved scroll position.

Best Regards.
Group: Developers | Support Team

  • info [at] cgdevtools.com - General information
  • sales [at] cgdevtools.com - Sales department
  • support [at] cgdevtools.com - Product and Technical Support
User avatar
Alexander Bulei
Site Admin
 
Posts: 3635
Joined: 15 May 2012 08:52
Location: Mealhada, Portugal

by George » 06 Nov 2015 12:49

Hello!

This not work and problem stands inside IW code.
I know 2 options to execute custom JS from CG code after rendering.
  • with rramOldMethod: CGAddJavaScriptToAjaxResponse()
  • with rramLazyLoad: AAfterLazyLoadJS
Both ways executes custom JS too early, when page is not rendered fully.
Since i use rramOldMethod with CGAddJavaScriptToAjaxResponse, i dived into source and found that you use IWApp.CallbackResponse.AddJavaScriptToExecute. (you may use AddJavaScriptToExecuteAsCDATA instead of adding tags manually).
So, when this code will be executed is totally depends on IW code.
I tried add "debugger;" JS code and check when it will be executed.
And you know what? Looks like it executes when dom is not rendered completely, it's impossible to scroll at correct position.

When executes custom JS,
Few steps next (almost ready)
One step next (finally dom is ready)

Only way to execute JS from CGAddJavaScriptToAjaxResponse at moment when dom is ready - use setTimeout which will sometimes work and sometimes not (on slow PC), in addition user will see how page scrolls down which is not cool at all(

i don't like setTimeout and don't know how to be.
Probably i have to carefully patch IW source once more or find other solution.
Future IW update becomes more and more hard task.

Maybe you can discuss this issue with Alexandre?
Best regards!
George
 
Posts: 486
Joined: 23 May 2013 15:50
Location: Russia, Moscow

by George » 06 Nov 2015 14:20

I'll try to make simple demo.
Best regards!
George
 
Posts: 486
Joined: 23 May 2013 15:50
Location: Russia, Moscow

by bryl » 27 Jun 2017 03:47

I have the same issue, is there a demo?
bryl
 
Posts: 15
Joined: 23 Mar 2017 17:23

by Alexander Bulei » 29 Jun 2017 12:16

Hi bryl,

To do that, you need use the AjaxRender with 3 parameters:

delphi code
IWCGJQGoogleAutoComplete1.AjaxReRender(True, rramLazyLoad, '<your_js_script_here>');


But before, you need save the scroll position to some global variable (via javascript), and then of 3rd parameter of AjaxReRender, use that var to restore the scroll position.

Best Regards.
Group: Developers | Support Team

  • info [at] cgdevtools.com - General information
  • sales [at] cgdevtools.com - Sales department
  • support [at] cgdevtools.com - Product and Technical Support
User avatar
Alexander Bulei
Site Admin
 
Posts: 3635
Joined: 15 May 2012 08:52
Location: Mealhada, Portugal


Return to JQRegion

cron

Who is online

Users browsing this forum: No registered users and 1 guest

Contact Us.