Hi Ignacio!
The html_safe almost works. (I tried that but put it in the wrong place
:-[ ).
Now the only problem is much stranger.
When I click the button once, it generates a JS response and the page
renders correctly with appropriate data changes. The second and all
subsequejt times I click it generates an HTML response and the page
renders without the data outside the <def> and with no styling. The
data that is displayed is correct, it just looks funny =-O . I did have
to add an html template to get this far, without it I just get a missing
template exception. I didn't think I would have needed the html and I
would really like to get the buttons to always generate JS like the
first time.
It must have something to do with context because the html for the
button stays the same in firebug, it just works without ajax on all
clicks but the first.
Any Ideas?
Don
On 09/25/2014 12:06 PM, Ignacio Huerta wrote:
Hi Don,
Your HTML is being escaped. You need something like this:
$('#agenda_items').html('<%=j render(:partial => 'agendas/table_plus',
:locals => { :this => @this }).html_safe %>');
You can also use "raw(html_string)" I think.
Please say if this doesn't help :)
Regards,
Ignacio
El 25/09/14 a las #4, Donald Ziesig escribió:
Another strange one:
I am trying to render a partial (dryml) from javascript. The javascript
is a one-liner:
$('#agenda_items').html('<%=j render :partial => 'agendas/table_plus',
:locals => { :this => @this } %>');
The partial is also rather trivial:
<table-plus with="&this.agenda_items" fields="position, this">
<controls:><controls-with-up-dn/></controls:>
</table-plus>
Unfortunately, in the <div id="agenda_items" > ... </div>
Instead of the table-plus and all its entries being rendered, the html
(correct as near as I can tell) is rendered as text:
<div class="table-plus"><div class="header"><div class="search"> <form
action="" class="search-form" method="get"><div
class="hidden-fields"></div> <span class="label">Search</span> <input
class="search" name="search" type="search"><input class="button
submit-button search-button search-submit" type="submit"
value="Go"></form> </div></div> <table> <thead><tr
class="field-heading-row"> <th class="position-heading"> <a
class="column-sort position-heading-link"
href="/agenda_items/4-approval-of-last-month-s-minutes/ ****
The code in the partial renders correctly when invoked directly.
What am I missing?
Thanks,
Don Ziesig
--
You received this message because you are subscribed to the Google Groups "Hobo
Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/hobousers.
For more options, visit https://groups.google.com/d/optout.