Topic: [FIXED] Page jump (auto-scroll) bug?

Hi Chrilith,

I am building a webapp to offer basic functionality for an established hotel PMS. All is going relatively well thanks to your excellent framework but now I have a bug which is causing a few problems. I have an iList of links (hotel room bookings) that leads to a form (information about each booking) containing iRadio selectors (e.g. room number, number of occupants etc.). Note that both the iList and the form are longer than the viewport is deep. If I have to scroll down the list of room bookings to find the one I want to alter, I select the booking and the form slides in just fine. Then I tap an iRadio element and the options slide in just fine. However, when I tap the required option, the form slides in from the left but then jumps to the bottom of the form/page, effectively hiding potentially vital information about the choice made, shown at the top of the page (e.g. "you cannot end a booking before it has started").

This only happens when the parent iList has had to be scrolled, and whist it is good that the system remembers that the iList had to be scrolled for when the page is returned to, in this case it is automatically applying that scroll to the wrong page. Can you or anyone else think of a way round this premature auto-scroll action please? ...either to disable it for child pages, or to force my form to always scroll to the top with JS?

Roy.

Edit: I have a workaround as follows...

if (evt.context[1][0] == "waBookingForm") {
    setTimeout(function () { window.scrollTo(0, 1); }, 1000);
}

...but this results in the page jumping down then up again. If anyone knows a neater solution, please tell smile

Last edited by losttheplot (2012-08-09 09:09:22)


Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /homepages/24/d260627385/htdocs/chrilith.com/forums/include/parser.php on line 738

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /homepages/24/d260627385/htdocs/chrilith.com/forums/include/parser.php on line 738

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /homepages/24/d260627385/htdocs/chrilith.com/forums/include/parser.php on line 738

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /homepages/24/d260627385/htdocs/chrilith.com/forums/include/parser.php on line 738

Re: [FIXED] Page jump (auto-scroll) bug?

Hi losttheplot,

Nice to see you back smile I hope verything is OK.

About you problem, I know this is a concern for many people. I'm trying to find time to complete the new version I put on GitHub, but it is not easy sorry to all about that. Using the debug version, you can edit the Logic.js file and change the AdjustView() function

function AdjustView(to) {
    to = $pc.customScroll || to;
    $pc.customScroll = null;
...
}

and then, in you code, you can set the value of the scrolling to whatever you want using the "beginslide" event (I think smile) and setting WebApp.customScroll.

Let me know if that helps. Anyway, the solution to your problem is in the tweak of AdjustView().

We need Amazon reviewers. Please do one!
Book: "Beginning iPhone and iPad Web Apps: Scripting with HTML5, CSS3, and JavaScript" Buy Now! (or review).
/!\ Don't forget to "Like" WebApp.Net from the homepage

Re: [FIXED] Page jump (auto-scroll) bug?

Hi Chris,

Everything is fine now, thanks. Lots of personal troubles have gotten in the way of my business, but now I am finally putting together the webapp extension to our hotel PMS that I told you about before. Yet again, I am impressed with your framework. It is proving taxing for me to modify given my rudimentary knowledge of JS, but I'm getting there bit-by-bit and the now-complex app is looking fab and slick smile I'm glad to hear that you are still working on it - for a while I thought you'd abandoned it!

With regards to your suggestion above, I understand what you're saying, but I am using the latest stable version as linked to on your home page: v0.5.2, and there is no AdjustView(to) function in Logic.js. Would you recommend that I use a later version, and if so, where should I get it from?

Roy.

Re: [FIXED] Page jump (auto-scroll) bug?

Ok, good smile

ABout the function, it is present as is in the debug version.

If you look at the release version, minified, the function has another name: _EE(...), the code to change is:

function _EE(to){to=$pc.customScroll||to;  .............

Here there is only the required change. Untested of course big_smile

We need Amazon reviewers. Please do one!
Book: "Beginning iPhone and iPad Web Apps: Scripting with HTML5, CSS3, and JavaScript" Buy Now! (or review).
/!\ Don't forget to "Like" WebApp.Net from the homepage

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /homepages/24/d260627385/htdocs/chrilith.com/forums/include/parser.php on line 738

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /homepages/24/d260627385/htdocs/chrilith.com/forums/include/parser.php on line 738

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /homepages/24/d260627385/htdocs/chrilith.com/forums/include/parser.php on line 738

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /homepages/24/d260627385/htdocs/chrilith.com/forums/include/parser.php on line 738

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /homepages/24/d260627385/htdocs/chrilith.com/forums/include/parser.php on line 738

Re: [FIXED] Page jump (auto-scroll) bug?

I didn't realise that you named the functions differently, having never used the debug version. I'm used to working with minimised code, so this is no problem. I have added 'to=to||$pc.customScroll;' to the start of the _EE function, but I obviously have not set the JS value correctly, being the novice at JS that I am, because your solution is not working. I have this, but what is the correct syntax please?

if (evt.context[1][0] == "waBookingForm") { WebApp.customScroll = 0; }

Re: [FIXED] Page jump (auto-scroll) bug?

Well, ok. I think I need you to send me a example so that I can test it. Can you?

We need Amazon reviewers. Please do one!
Book: "Beginning iPhone and iPad Web Apps: Scripting with HTML5, CSS3, and JavaScript" Buy Now! (or review).
/!\ Don't forget to "Like" WebApp.Net from the homepage

Re: [FIXED] Page jump (auto-scroll) bug?

Email sent - thanks smile

Re: [FIXED] Page jump (auto-scroll) bug?

OK, I found the bug. The scrolling position isn't saved properly using radio layer and the previous position is used.

This is now fixed and will be part of the next version. I'll send you the preview.

We need Amazon reviewers. Please do one!
Book: "Beginning iPhone and iPad Web Apps: Scripting with HTML5, CSS3, and JavaScript" Buy Now! (or review).
/!\ Don't forget to "Like" WebApp.Net from the homepage

Re: [FIXED] Page jump (auto-scroll) bug?

Yay big_smile  ...that works a treat, Chris, as you can see for yourself if you want to check. Thank you very much for your excellent work.

Re: [FIXED] Page jump (auto-scroll) bug?

Great news! Don't forget the WebApp.SetScroll() function if you want to keep the user at a given scrolling position.

I close this bug, thanks

We need Amazon reviewers. Please do one!
Book: "Beginning iPhone and iPad Web Apps: Scripting with HTML5, CSS3, and JavaScript" Buy Now! (or review).
/!\ Don't forget to "Like" WebApp.Net from the homepage