scrolling to top of nested scaffold

52 views
Skip to first unread message

Nick Rogers

unread,
May 24, 2012, 1:15:59 PM5/24/12
to ActiveScaffold : Ruby on Rails plugin
I have a page with a few nested scaffolds in it. Recent versions of active_scaffold seem to automatically scroll my browser to the bottom of the page (the last nested scaffold). Is there a way to disable this new behavior? Thanks.

-Nick

ser...@entrecables.com

unread,
May 24, 2012, 3:22:13 PM5/24/12
to actives...@googlegroups.com
Scrolling is not a new behaviour, but I had some issues while I was
trying to improve it. Please, explain more your issue. Anyway you can
disable all scrolling with ActiveScaffold.js_config
https://github.com/activescaffold/active_scaffold/wiki/JS-config

By default, scrolling should happen only when displaying messages or
opening nested scaffolds or forms and the top is out of viewport.

On Thu, 24 May 2012 13:15:59 -0400, Nick Rogers <ncro...@gmail.com>
wrote:
> --
> You received this message because you are subscribed to the Google
> Groups "ActiveScaffold : Ruby on Rails plugin" group.
> To post to this group, send email to actives...@googlegroups.com.
> To unsubscribe from this group, send email to
> activescaffol...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/activescaffold?hl=en.

Nick Rogers

unread,
May 25, 2012, 10:24:04 AM5/25/12
to actives...@googlegroups.com
I tried setting  ActiveScaffold.js_config = { }, and  ActiveScaffold.js_config = {:scroll_on_close => false }

I have a view with 4 nested scaffolds. I am using render_component to render the inline scaffolds. I make my browser window is small enough that I have to scroll to see all the scaffolds. After the page loads, javascript is causing the browser to scroll to the last scaffold so that the last scaffold is in the viewport.

For example:

<%= render :active_scaffold => "apples" %>

<%= render :active_scaffold => "oranges" %>

<%= render :active_scaffold => "monkeys" %>

<%= render :active_scaffold => "dogs" %>

// browser scrolls so this scaffold in viewport
<%= render :active_scaffold => "cats" %>

ser...@entrecables.com

unread,
May 26, 2012, 4:05:36 AM5/26/12
to actives...@googlegroups.com
I can't find when a embedded scaffold can call scroll_to method,
neither using render_component nor ajax. Really, using render_component
shouldn't execute any javascript code.

Can you set a breakpoint in first line of ActiveScaffold.scroll_to and
reload the page? So you can get the trace in web inspector (chrome) or
firebug (firefox)
I'm not getting that behaviour, without using render_component, which
could be more probable to scroll becuase using ajax to load embedded
scaffolds.

On Fri, 25 May 2012 10:24:04 -0400, Nick Rogers <ncro...@gmail.com>
wrote:
> I tried setting  ActiveScaffold.js_config = { },
> and  ActiveScaffold.js_config = {:scroll_on_close => false }
>
> I have a view with 4 nested scaffolds. I am using render_component to
> render the inline scaffolds. I make my browser window is small enough
> that I have to scroll to see all the scaffolds. After the page loads,
> javascript is causing the browser to scroll to the last scaffold so
> that the last scaffold is in the viewport.
>
> For example:
>
> "apples" %>
>
> "oranges" %>
>
> "monkeys" %>
>
> "dogs" %>
>
> // browser scrolls so this scaffold in viewport
> "cats" %>
>
> On Thu, May 24, 2012 at 3:22 PM, wrote:
> Scrolling is not a new behaviour, but I had some issues while I was
> trying to improve it. Please, explain more your issue. Anyway you can
> disable all scrolling with ActiveScaffold.js_config
> https://github.com/activescaffold/active_scaffold/wiki/JS-config [2]
>
> By default, scrolling should happen only when displaying messages or
> opening nested scaffolds or forms and the top is out of viewport.
>
> On Thu, 24 May 2012 13:15:59 -0400, Nick Rogers
> wrote:
>
>> I have a page with a few nested scaffolds in it. Recent versions of
> > active_scaffold seem to automatically scroll my browser to the
> bottom
> > of the page (the last nested scaffold). Is there a way to disable
> this
> > new behavior? Thanks.
> >
> > -Nick
> >
> >  --
> >  You received this message because you are subscribed to the
> Google
> > Groups "ActiveScaffold : Ruby on Rails plugin" group.
> >  To post to this group, send email to
> actives...@googlegroups.com [4].
> >  To unsubscribe from this group, send email to
> > activescaffol...@googlegroups.com [5].
> >  For more options, visit this group at
> > http://groups.google.com/group/activescaffold?hl=en [6].
>
> --
> You received this message because you are subscribed to the Google
> Groups "ActiveScaffold : Ruby on Rails plugin" group.
> To post to this group, send email to actives...@googlegroups.com
> [7].
> To unsubscribe from this group, send email to
> activescaffol...@googlegroups.com [8].
> For more options, visit this group at
> http://groups.google.com/group/activescaffold?hl=en [9].
>
> --
> You received this message because you are subscribed to the Google
> Groups "ActiveScaffold : Ruby on Rails plugin" group.
> To post to this group, send email to actives...@googlegroups.com.
> To unsubscribe from this group, send email to
> activescaffol...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/activescaffold?hl=en.
>
>
> Links:
> ------
> [1] mailto:ser...@entrecables.com
> [2] https://github.com/activescaffold/active_scaffold/wiki/JS-config
> [3] mailto:ncro...@gmail.com
> [4] mailto:actives...@googlegroups.com
> [5] mailto:activescaffold%2Bunsu...@googlegroups.com
> [6] http://groups.google.com/group/activescaffold?hl=en
> [7] mailto:actives...@googlegroups.com
> [8] mailto:activescaffold%2Bunsu...@googlegroups.com
> [9] http://groups.google.com/group/activescaffold?hl=en

Nick Rogers

unread,
May 28, 2012, 1:06:37 PM5/28/12
to actives...@googlegroups.com
The problem seems to have something to do with render_component and the fact that I am using jQuery and prototype simultaneously, but I cannot track down where its breaking. If I disable render_component and use ajax for inline scaffold rendering, the problem goes away. Any suggestions? It is probably a case where there is a $( or $. expecting to use jQuery and instead for me it is using prototype because I use "jQuery.noConflict()".

ser...@entrecables.com

unread,
May 29, 2012, 1:51:47 AM5/29/12
to actives...@googlegroups.com
I will try to look for something like that.

On Mon, 28 May 2012 13:06:37 -0400, Nick Rogers <ncro...@gmail.com>
wrote:
> The problem seems to have something to do with render_component and
> the fact that I am using jQuery and prototype simultaneously, but I
> cannot track down where its breaking. If I disable render_component
> and use ajax for inline scaffold rendering, the problem goes away. Any
> suggestions? It is probably a case where there is a $( or $. expecting
> to use jQuery and instead for me it is using prototype because I use
> "jQuery.noConflict()".
>
> On Sat, May 26, 2012 at 4:05 AM, wrote:
> I can't find when a embedded scaffold can call scroll_to method,
> neither using render_component nor ajax. Really, using
> render_component
> shouldn't execute any javascript code.
>
> Can you set a breakpoint in first line of ActiveScaffold.scroll_to
> and
> reload the page? So you can get the trace in web inspector (chrome)
> or
> firebug (firefox)
> I'm not getting that behaviour, without using render_component, which
> could be more probable to scroll becuase using ajax to load embedded
> scaffolds.
>
> On Fri, 25 May 2012 10:24:04 -0400, Nick Rogers
> [3] [2]
>
>>
> >  By default, scrolling should happen only when displaying messages
> or
> >  opening nested scaffolds or forms and the top is out of viewport.
> >
> >  On Thu, 24 May 2012 13:15:59 -0400, Nick Rogers
>
>>  wrote:
> >
> >> I have a page with a few nested scaffolds in it. Recent versions
> of
> >  > active_scaffold seem to automatically scroll my browser to the
> > bottom
> >  > of the page (the last nested scaffold). Is there a way to
> disable
> > this
> >  > new behavior? Thanks.
> >  >
> >  > -Nick
> >  >
> >  >  --
> >  >  You received this message because you are subscribed to the
> > Google
> >  > Groups "ActiveScaffold : Ruby on Rails plugin" group.
> >  >  To post to this group, send email to
> > actives...@googlegroups.com [4] [4].
>
>>  >  To unsubscribe from this group, send email to
> >  > activescaffol...@googlegroups.com [5] [5].
>
>>  >  For more options, visit this group at
> >  > http://groups.google.com/group/activescaffold?hl=en [6] [6].
>
>>
> >  --
> >  You received this message because you are subscribed to the
> Google
> > Groups "ActiveScaffold : Ruby on Rails plugin" group.
> >  To post to this group, send email to
> actives...@googlegroups.com [7]
> > [7].
>
>>  To unsubscribe from this group, send email to
> > activescaffol...@googlegroups.com [8] [8].
>
>>  For more options, visit this group at
> > http://groups.google.com/group/activescaffold?hl=en [9] [9].
>
>>
> >  --
> >  You received this message because you are subscribed to the
> Google
> > Groups "ActiveScaffold : Ruby on Rails plugin" group.
> >  To post to this group, send email to
> actives...@googlegroups.com [10].
> >  To unsubscribe from this group, send email to
> > activescaffol...@googlegroups.com [11].
> >  For more options, visit this group at
> > http://groups.google.com/group/activescaffold?hl=en [12].
> >
> >
> > Links:
> > ------
> > [1] mailto:ser...@entrecables.com [13]
> > [2]
> https://github.com/activescaffold/active_scaffold/wiki/JS-config [14]
> > [3] mailto:ncro...@gmail.com [15]
> > [4] mailto:actives...@googlegroups.com [16]
> > [5] mailto:activescaffold%2Bunsu...@googlegroups.com [17]
> > [6] http://groups.google.com/group/activescaffold?hl=en [18]
> > [7] mailto:actives...@googlegroups.com [19]
> > [8] mailto:activescaffold%2Bunsu...@googlegroups.com [20]
> > [9] http://groups.google.com/group/activescaffold?hl=en [21]
>
> --
> You received this message because you are subscribed to the Google
> Groups "ActiveScaffold : Ruby on Rails plugin" group.
> To post to this group, send email to actives...@googlegroups.com
> [22].
> To unsubscribe from this group, send email to
> activescaffol...@googlegroups.com [23].
> For more options, visit this group at
> http://groups.google.com/group/activescaffold?hl=en [24].
>
> --
> You received this message because you are subscribed to the Google
> Groups "ActiveScaffold : Ruby on Rails plugin" group.
> To post to this group, send email to actives...@googlegroups.com.
> To unsubscribe from this group, send email to
> activescaffol...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/activescaffold?hl=en.
>
>
> Links:
> ------
> [1] mailto:ser...@entrecables.com
> [2] mailto:ncro...@gmail.com
> [3] https://github.com/activescaffold/active_scaffold/wiki/JS-config
> [10] mailto:actives...@googlegroups.com
> [11] mailto:activescaffold%2Bunsu...@googlegroups.com
> [12] http://groups.google.com/group/activescaffold?hl=en
> [13] mailto:ser...@entrecables.com
> [14] https://github.com/activescaffold/active_scaffold/wiki/JS-config
> [15] mailto:ncro...@gmail.com
> [16] mailto:actives...@googlegroups.com
> [17] mailto:activescaffold%252Buns...@googlegroups.com
> [18] http://groups.google.com/group/activescaffold?hl=en
> [19] mailto:actives...@googlegroups.com
> [20] mailto:activescaffold%252Buns...@googlegroups.com
> [21] http://groups.google.com/group/activescaffold?hl=en
> [22] mailto:actives...@googlegroups.com
> [23] mailto:activescaffold%2Bunsu...@googlegroups.com
> [24] http://groups.google.com/group/activescaffold?hl=en

Hernan Astudillo

unread,
May 29, 2012, 1:06:09 PM5/29/12
to actives...@googlegroups.com
oops!!

RJS error:

TypeError: ActiveScaffold.js_config is undefined

when posting a form in a nested scaffold

Hernan Astudillo

unread,
May 29, 2012, 1:16:22 PM5/29/12
to actives...@googlegroups.com
ok, so i set
ActiveScaffold.js_config = { }
in application.js
and now everything got bizarre behavior:
when posted, nested got closed and parent row got replaced by child row (the one created in the nested AS)

Nano

Nick Rogers

unread,
May 31, 2012, 2:29:51 PM5/31/12
to actives...@googlegroups.com
Hi Sergio. Any luck with figuring this out?

On Tue, May 29, 2012 at 1:51 AM, <ser...@entrecables.com> wrote:

ser...@entrecables.com

unread,
May 31, 2012, 2:58:08 PM5/31/12
to actives...@googlegroups.com
No, I couldn't find any $ call in ActiveScaffold. Can you send me a
sample application failing?

On Thu, 31 May 2012 14:29:51 -0400, Nick Rogers <ncro...@gmail.com>
wrote:
> Hi Sergio. Any luck with figuring this out?
>
> On Tue, May 29, 2012 at 1:51 AM, wrote:
> I will try to look for something like that.
>
> On Mon, 28 May 2012 13:06:37 -0400, Nick Rogers
> >  > actives...@googlegroups.com [4] [4] [4].
>
>>
> >>  >  To unsubscribe from this group, send email to
> >  >  > activescaffol...@googlegroups.com [5] [5] [5].
>
>>
> >>  >  For more options, visit this group at
> >  >  > http://groups.google.com/group/activescaffold?hl=en [6] [6]
> [6].
>
>>
> >>
> >  >  --
> >  >  You received this message because you are subscribed to the
> > Google
> >  > Groups "ActiveScaffold : Ruby on Rails plugin" group.
> >  >  To post to this group, send email to
> > actives...@googlegroups.com [7] [7]
> >  > [7].
> >
> >>  To unsubscribe from this group, send email to
> >  > activescaffol...@googlegroups.com [8] [8] [8].
>
>>
> >>  For more options, visit this group at
> >  > http://groups.google.com/group/activescaffold?hl=en [9] [9]
> [9].
>
>>
> >>
> >  >  --
> >  >  You received this message because you are subscribed to the
> > Google
> >  > Groups "ActiveScaffold : Ruby on Rails plugin" group.
> >  >  To post to this group, send email to
> > actives...@googlegroups.com [10] [10].
>
>>  >  To unsubscribe from this group, send email to
> >  > activescaffol...@googlegroups.com [11] [11].
>
>>  >  For more options, visit this group at
> >  > http://groups.google.com/group/activescaffold?hl=en [12] [12].
> >  >
> >  >
> >  > Links:
> >  > ------
> >  > [1] mailto:ser...@entrecables.com [13] [13]
> >  > [2]
> > https://github.com/activescaffold/active_scaffold/wiki/JS-config
> [14] [14]
> >  > [3] mailto:ncro...@gmail.com [15] [15]
> >  > [4] mailto:actives...@googlegroups.com [16] [16]
> >  > [7] mailto:actives...@googlegroups.com [19] [19]
> >  > [8] mailto:activescaffold%2Bunsu...@googlegroups.com [20]
> [20]
> >  > [9] http://groups.google.com/group/activescaffold?hl=en [21]
> [21]
>
>>
> >  --
> >  You received this message because you are subscribed to the
> Google
> > Groups "ActiveScaffold : Ruby on Rails plugin" group.
> >  To post to this group, send email to
> actives...@googlegroups.com [22]
> > [22].
>
>>  To unsubscribe from this group, send email to
> > activescaffol...@googlegroups.com [23] [23].
>
>>  For more options, visit this group at
> > http://groups.google.com/group/activescaffold?hl=en [24] [24].
>
>>
> >  --
> >  You received this message because you are subscribed to the
> Google
> > Groups "ActiveScaffold : Ruby on Rails plugin" group.
> >  To post to this group, send email to
> actives...@googlegroups.com [25].
> >  To unsubscribe from this group, send email to
> > activescaffol...@googlegroups.com [26].
> >  For more options, visit this group at
> > http://groups.google.com/group/activescaffold?hl=en [27].
> >
> >
> > Links:
> > ------
> > [1] mailto:ser...@entrecables.com [28]
> > [2] mailto:ncro...@gmail.com [29]
> > [3]
> https://github.com/activescaffold/active_scaffold/wiki/JS-config [30]
>
>> [4] mailto:actives...@googlegroups.com [31]
> > [5] mailto:activescaffold%2Bunsu...@googlegroups.com [32]
> > [6] http://groups.google.com/group/activescaffold?hl=en [33]
> > [7] mailto:actives...@googlegroups.com [34]
> > [8] mailto:activescaffold%2Bunsu...@googlegroups.com [35]
> > [9] http://groups.google.com/group/activescaffold?hl=en [36]
> > [10] mailto:actives...@googlegroups.com [37]
> > [11] mailto:activescaffold%2Bunsu...@googlegroups.com [38]
> > [12] http://groups.google.com/group/activescaffold?hl=en [39]
> > [13] mailto:ser...@entrecables.com [40]
> > [14]
> https://github.com/activescaffold/active_scaffold/wiki/JS-config [41]
> > [15] mailto:ncro...@gmail.com [42]
> > [16] mailto:actives...@googlegroups.com [43]
> > [17] mailto:activescaffold%252Buns...@googlegroups.com [44]
> > [18] http://groups.google.com/group/activescaffold?hl=en [45]
> > [19] mailto:actives...@googlegroups.com [46]
> > [20] mailto:activescaffold%252Buns...@googlegroups.com [47]
> > [21] http://groups.google.com/group/activescaffold?hl=en [48]
> > [22] mailto:actives...@googlegroups.com [49]
> > [23] mailto:activescaffold%2Bunsu...@googlegroups.com [50]
> > [24] http://groups.google.com/group/activescaffold?hl=en [51]
>
> --
> You received this message because you are subscribed to the Google
> Groups "ActiveScaffold : Ruby on Rails plugin" group.
> To post to this group, send email to actives...@googlegroups.com
> [52].
> To unsubscribe from this group, send email to
> activescaffol...@googlegroups.com [53].
> For more options, visit this group at
> http://groups.google.com/group/activescaffold?hl=en [54].
> [25] mailto:actives...@googlegroups.com
> [26] mailto:activescaffold%2Bunsu...@googlegroups.com
> [27] http://groups.google.com/group/activescaffold?hl=en
> [28] mailto:ser...@entrecables.com
> [29] mailto:ncro...@gmail.com
> [30] https://github.com/activescaffold/active_scaffold/wiki/JS-config
> [31] mailto:actives...@googlegroups.com
> [32] mailto:activescaffold%252Buns...@googlegroups.com
> [33] http://groups.google.com/group/activescaffold?hl=en
> [34] mailto:actives...@googlegroups.com
> [35] mailto:activescaffold%252Buns...@googlegroups.com
> [36] http://groups.google.com/group/activescaffold?hl=en
> [37] mailto:actives...@googlegroups.com
> [38] mailto:activescaffold%252Buns...@googlegroups.com
> [39] http://groups.google.com/group/activescaffold?hl=en
> [40] mailto:ser...@entrecables.com
> [41] https://github.com/activescaffold/active_scaffold/wiki/JS-config
> [42] mailto:ncro...@gmail.com
> [43] mailto:actives...@googlegroups.com
> [44] mailto:activescaffold%25252Bun...@googlegroups.com
> [45] http://groups.google.com/group/activescaffold?hl=en
> [46] mailto:actives...@googlegroups.com
> [47] mailto:activescaffold%25252Bun...@googlegroups.com
> [48] http://groups.google.com/group/activescaffold?hl=en
> [49] mailto:actives...@googlegroups.com
> [50] mailto:activescaffold%252Buns...@googlegroups.com
> [51] http://groups.google.com/group/activescaffold?hl=en
> [52] mailto:actives...@googlegroups.com
> [53] mailto:activescaffold%2Bunsu...@googlegroups.com
> [54] http://groups.google.com/group/activescaffold?hl=en

Nick Rogers

unread,
Jun 15, 2012, 11:12:42 AM6/15/12
to actives...@googlegroups.com
Hi Sergio. I eventually isolated this to a problem specific to my application. Sorry for wasting your time and thanks much for the help as always.

-Nick
Reply all
Reply to author
Forward
0 new messages