I didn't see any response to this in the archives, and the patch
doesn't seem to have made it into 1.5.1.
The patch below seems to help when the form element is at the bottom
of the window, but what's the solution when the list is longer than
the window and part of the list is not visible? I tried using
overflow: auto css, but that seems to just add scroll bars but doesn't
help contain the list in the window.
On Thu, Dec 15, 2005 at 12:33:45AM +0100, Niels Ganser wrote:
> Hi everyone,
>
> lately I've implemented an auto completion textfield at the bottom of a
> form. I was a bit bothered by the fact that the user would potentially
> need to scroll down in order to see all the options offered by the auto
> completion. I couldn't find any information on how to auto scroll to the
> auto completion list with bulit-in functionality so I modified
> controls.js a tiny bit.
>
> I'm posting the patch here in order to hear how I should have done it
> without to touching the source or of course to get the patch
> incorporated into future releases.
>
> Greetings from Cologne, Germany,
> Niels.
> --- controls.js.old 2005-12-15 00:25:12.000000000 +0100
> +++ controls.js 2005-12-15 00:25:27.000000000 +0100
> @@ -61,6 +61,13 @@
> Position.clone(element, update, {setHeight: false, offsetTop:
> element.offsetHeight});
> }
> Effect.Appear(update,{duration:0.15});
> +
> + var scrollToAutoComplete = function () {
> + offsets = Position.cumulativeOffset(element);
> + window.scrollTo(offsets[0], offsets[1]);
> + };
> + setTimeout(scrollToAutoComplete, 150);
> +
> };
> this.options.onHide = this.options.onHide ||
> function(element, update){ new Effect.Fade(update,{duration:0.15}) };
> _______________________________________________
> Rails-spinoffs mailing list
> [email protected]
> http://lists.rubyonrails.org/mailman/listinfo/rails-spinoffs
--
Bill Moseley
[EMAIL PROTECTED]
_______________________________________________
Rails-spinoffs mailing list
[email protected]
http://lists.rubyonrails.org/mailman/listinfo/rails-spinoffs