El Tuesday 01 December 2015 15:27:31 Jim escribió:
On Friday, October 23, 2015 at 7:02:34 AM UTC-4, Sergio Cambra wrote:
On page load ActiveScaffold call this methods:
ActiveScaffold.load_embedded(document);
ActiveScaffold.enable_js_form_buttons(document);
ActiveScaffold.live_search(document); ActiveScaffold.auto_paginate(document);
ActiveScaffold.draggable_lists('.draggable-lists', document);
Also, ActiveScaffold adds a listener for as:element_updated event, and call
this methods
there: ActiveScaffold.load_embedded(e.target);
ActiveScaffold.enable_js_form_buttons(e.target);
ActiveScaffold.live_search(e.target);
ActiveScaffold.draggable_lists('.draggable-lists', e.target);
So you could add a listener to your menu links, to trigger that event when
success:
$(document).on('ajax:success', 'selector for menu link', function() { $
(document).trigger('as:element_updated); });
I have a page with several embedded scaffolds. Ideally, after performing a
remote action,
I would like to refresh a specific scaffold. I thought that maybe triggering
as:element_updated on the scaffold div might update it, but no joy.
ActiveScaffold.load_embedded(document); did nothing either. I finally figured
out that if
I replace the embedded scaffold with a newly-rendered embedded scaffold (the
original
placeholder div), calling ActiveScaffold.load_embedded(document); would then
find that
placeholder and reload it.
It works, but is there a more direct way to refresh an embedded scaffold?
Jim Crate
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=...&embedded=true" id="...">
So, you can use this:
ActiveScaffold.reload($('selector for embedded').data('refresh'));
-- 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 activescaffold
[email protected][1].To post to this group, send email to
[email protected][2].Visit this group at http://groups.google.com/
group/activescaffold[3].For more options, visit
https://groups.google.com/d/optout[4].
--------
[1] mailto:[email protected]
[2] mailto:[email protected]
[3] http://groups.google.com/group/activescaffold
[4] https://groups.google.com/d/optout
--
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.