Append widget to a div?

29 views
Skip to first unread message

Pedro Nascimento

unread,
Jan 23, 2012, 12:49:17 PM1/23/12
to Cells and Apotomo
Hi, I'm trying to append a widget to a div, but can't seem to do so.

My widget is like this:

Notice that on add_widget(evt) I want to append what the widget renders, but can't seem to do so.
If I replace line 13 with something simpler like render :text => "alert('test');" it works, though. I've tried unescape_javascript, but looks like this is unavailable at this scope.

What am I doing wrong, or better, what should I be doing?

Thanks!

Nick Sutterer

unread,
Jan 23, 2012, 3:26:36 PM1/23/12
to cells-an...@googlegroups.com
Hi Pedro,

On Mon, Jan 23, 2012 at 6:49 PM, Pedro Nascimento <pnasc...@gmail.com> wrote:
> Hi, I'm trying to append a widget to a div, but can't seem to do so.
>
> My widget is like this:
> http://pastie.org/3238256
>
> Notice that on add_widget(evt) I want to append what the widget renders, but
> can't seem to do so.
> If I replace line 13 with something simpler like render :text =>
> "alert('test');" it works, though. I've tried unescape_javascript, but looks
> like this is unavailable at this scope.
>

Well you need to escape the JS in the append string. Try #escape_js.

Also, you don't need the :after_initialize hook. Try this:
http://nicksda.apotomo.de/2011/10/released-apotomo-1-2/ Using the
:passing option you should be fine!!!

Reply all
Reply to author
Forward
0 new messages