On Wednesday, December 2, 2015 at 1:50:08 AM UTC-5, Sergio Cambra wrote:
>
> I think there is no method for that, but div for embedded scaffolds have 
> data-refresh attribute:
>
>  
>
> <div class="active-scaffold-component" 
> data-refresh="/controller?eid=...&amp;embedded=true" id="...">
>
>  
>
> So, you can use this:
>
>  
>
> ActiveScaffold.reload($('selector for embedded').data('refresh'));
>

That sends a request that returns the appropriate html in the response, but 
does not actually update the content that appears on the page. So I dug 
into the ActiveScaffold jquery javascript and saw that reload just calls 
jquery's getScript function, but since HTML is returned and not javascript 
then it doesn't do anything. A little digging into load_embedded showed me 
the correct path.

var embedded = $('selector for embedded');
embedded.load(embedded.data('refresh'), function() {
$(this).trigger('as:element_updated');
});

Clean and simple! Thanks for your help.

Jim Crate

-- 
You received this message because you are subscribed to the Google Groups 
"ActiveScaffold : Ruby on Rails Gem" 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/activescaffold.
For more options, visit https://groups.google.com/d/optout.

Reply via email to