Thank you very much Sergio for your excellent solution, it is much
appreciated.

Regards
Willem

On May 4, 4:27 pm, "Sergio Cambra .:: entreCables S.L. ::."
<[email protected]> wrote:
> El Wednesday 29 April 2009 22:06:30 Willem escribió:
>
>
>
> > Thanks for active_scaffold, which is an excellent plugin.
>
> > Any ideas about the following would be much appreciated. We have the
> > following 2 database tables:
>
> > lecturers table
> > id   name
> > ------------
> > 1    John
> > 2    Pttrr
>
> > subjects table:
> > id name      lecturer_id
> > --------------------------------
> > 1  Geometry  1
> > 2  Maths         2
> > 3  Science     2
>
> > (So in effect the subjects Maths and Science share the same lecturer)
>
> > On active_scaffold it is correctly shown as follows:
> > Class            Lecturer
> > -------             --------
> > Geometry    John
> > Maths           Pttrr
> > Science       Pttrr
>
> > When we now edit and update an active scaffold row (for example change
> > Pttrr to Peter in the Maths row), after the update active_scaffold
> > shows:
> > Class         Lecturer
> > -------           --------
> > Geometry   John
> > Maths          Peter
> > Science      Pttrr
>
> > Only when one refreshes the page again, it correctly shows the updated
> > Lecturer value for the Science class as well:
> > Class           Lecturer
> > -------              --------
> > Geometry    John
> > Maths           Peter
> > Science       Peter
>
> > Any suggestions as to what we could do to immediately update Peter for
> > the Science row when it has been updated in the Maths row?
>
> You can override on_update.js.rjs to add some javascript code. Create
> on_update.js.rjs in app/views/subjects/on_update.js.rjs, calling
> render :super and adding your javascript to reload another subjects
>
> page << render(:super)
> @record.lecturer.subjects.each do |subject|
> page << %|var row = $("#{element_row_id(:action => :list, :id =>
> subject.id)}");
> if (row) {
>         new Ajax.Updater(row, "#{}", {onComplete: function() {
>                         if (row.hasClassName('even-record')) 
> $(row.id).addClassName('even-record');
>                 }
>         });}|
>
> end
>
> --
> 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