On Jueves, 17 de Diciembre de 2009 12:42:37 Swartz escribió:
> On Dec 17, 4:52 am, "Sergio Cambra .:: entreCables S.L. ::."
>
> <[email protected]> wrote:
> > On Jueves, 17 de Diciembre de 2009 10:59:46 Swartz escribió:
> >
> > Also, you can use after_render_field (maybe it's the best way). Define
> > after_render_field in your controller to set @record.member_pay from
> > membership cost:
> >
> > def after_render_field(record, column)
> > record.member_pay = record.membership.cost
> > end
>
> Hmmmm... this function appears to not be called at all.
> I defined this in the MembersController right after the AS block.
> I even inserted a breakpoint in the function to see if it gets called.
> It simply doesn't get called.
render_field is called for current controller, in your log render_field was
called for ContractsController, so you can put there, instead of
MembersController.
>
> With just
> config.columns[:membership].options = {:update_column => :member_pay}
> It appears that the member_pay field gets updated whenever I select a
> different membership option from drop down menu.
> As indicated by this AJAX response:
>
> try {
> $("record_member_pay_").up("li").update("\n<dl class=\"\">\n <dt>\n
> <label for=\"record_member_pay_\">Member Pay</label>\n </dt>\n <dd>\n
> <input autocomplete=\"off\" class=\"member-pay-input text-input\" id=
> \"record_member_pay_\" name=\"record[member_pay]\" size=\"30\" type=
> \"text\" />\n <span class=\"description\"></span>\n </dd>\n</dl>");
> }
> // ... snipped the catch block ...
>
>
> The only thing needed is to add value="X" attribute for <input> tags
> generated by AJAX responses for each membership option. Just can't
> figure out how the heck to do it.
That is fixed with after_render_field (in the right controller). I gave you two
more fixes, in the model and helper, did you try them?
--
Sergio Cambra .:: entreCables S.L. ::.
Mariana Pineda 23, 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.