Sergio,

Thanks for the answer. Finally had some time to play with this.

So first of all - I know nothing about how AS works under the hood -
so forgive me if I ask dumb questions.

The index page of the controller in question is the one where all the
fun is located. So it has two embedded AS's - one for user and one for
students. Further down the page it has two dynamic sections - I call
them section3 and section4.

If the user has created any students then the section3 needs to be
updated. And if they have completed section3 then section4 get
enabled.

I tried to add app/views/<controller>/on_create.rjs (I use rails 2.2)
In that file I have:
page << render(:super)
page.replace_html "section3", :partial => "section3"
page.replace_html "section4", :partial => "section4"

On the index page the two sections are properly identified with <div
id=section3> ... </div> etc. The index page further has a
render :partial for both to ensure that it loads in a proper way.
I notice that the on_create gets called when the there is a create
action in the AS, but section3 and section4 are never updated. Do I
need to do something different here.

What other actions can I support? Anything that catches a destroy?

/S

On Apr 27, 2:28 am, "Sergio Cambra .:: entreCables S.L. ::."
<[email protected]> wrote:
> El Saturday 25 April 2009 23:27:49 Soren escribió:
>
> > I have a page upon which I have to embedded scaffolds.
>
> > At some point the user might have created data with those scaffolds
> > such that additional options to the page should be enabled.
>
> > Any suggestions to cause the page to get reloaded after an CRUD action
> > on one of the scaffold (simplest solution) or how to cause an AJAX
> > action to trigger that would update the page with the new options.
>
> > Is the before_create_save action in AS a path anyonehassuccessfully
> > used for this ?
>
> > /S
>
> You should add some javascript to the views to reload the scaffold, or add a
> new link with javascript after a create for example. Try to create a
> on_create.js.rjs view (in rails 2.3, on_create.rjs in previous versions) in
> your controller's views, call render :super to include the default response
> and add your javascript code.
>
> For example:
> page << render(:super)
> page.insert_html :top, active_scaffold_tbody_id, 'html code'
> page.insert_html :top, active_scaffold_tbody_id, :partial => 'partial_name'
> page << 'custom JS code'
>
> --
> Sergio Cambra .:: entreCables S.L. ::.
> Nicolás Guillén 6, locales 2 y 3. 50.018 Zaragoza
> T) 902 021 404 F) 976 52 98 07 E) [email protected]
--~--~---------~--~----~------------~-------~--~----~
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 [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/activescaffold?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to