Hi,
finally I found this mailing list to put my question or suggestion. I am
starting to migrate all my Javascript applications to use prototype, and it
is really nice. I can remove so much self programmed code. Nicely done.
One thing still left a problem with the AJAX methods.

I have an application where the navigation updates multiple divs with their
new content. So I use the Ajax.Updater passing the element I want to update.
But since these divs are scrollable (either with browser scroll from
overflow:auto, or with my custom made scrollbar using scrollTop = scrollTop
+ some extra lines.) I end up with a problem:
When I scrolled the element a bit down, then trigger something that triggers
the updater, the content gets replaced, but I am still at the same scroll
position.

Okay I reckon that this can be even wanted. So I tried to find out where I
can do some postprocessing and set element.scrollTop=0.
I noticed that the regular Ajax.Request is also lacking the options to pass
the onXXX methods some own parameter. So I cannot know in the method where I
could put some code which element I am working on I have only the XHR and
the json headers.
The only solution would be to create the updater 3 times for each of my divs
and put in every a different callback method. However that doesn't look
clean for me.

So I have currently patched the updater with:
       receiver.scrollTop = 0;
before
        Element.update(receiver, response);

Because of that you might not always to scroll up and there might be some
other resetting things the developer might want to do I would think of a
standard way to give the callback method additional parameters. Especially
the Updater, which already knows that it is working on a specific element.

Or is there already one and I just have not seen it?

Best Regards
Fabian

_______________________________________________
Rails-spinoffs mailing list
Rails-spinoffs@lists.rubyonrails.org
http://lists.rubyonrails.org/mailman/listinfo/rails-spinoffs

Reply via email to