You would have to set form_ui = :hidden on after_render_field (controller
method). If you
do that you should set form_ui on do_edit and do_new also (or before_filter
:set_column_form_ui, :only => [:new, :create, :edit, :update])
Also you can override field_attributes(column, record) helper to set a class
(it will be used
on dl tag) then you can hide with css.
def field_attributes(column, record)
if conditions_to_hide_column
{:class => '...'}
else
super
end
end
El Martes, 2 de junio de 2015 09:51:15 Gloufy escribió:
> it's work perfectely ! thanks you so much !
> Last question how to hide or show a field after a update_columns ?
>
> Le mardi 2 juin 2015 17:33:49 UTC+2, Sergio Cambra a écrit :
> > That code won't load any city, because record.postal_code would be nil.
> >
> > Really it would load cities with no postal code, but I'm guessing every
> > would have a postal code
> >
> > El Martes, 2 de junio de 2015 08:22:28 Gloufy escribió:
> > > thank you ! and for the city i have :
> > >
> > > config.columns[:city].form_ui = :select
> > >
> > > how to begin with options for the select with none record (because i've
> > >
> > > 36000 cites in the database)
> > >
> > > i just want a list in the select when zip code is not null...
> > >
> > > Le mardi 2 juin 2015 17:03:44 UTC+2, Sergio Cambra a écrit :
> > > > Define options_for_association_conditions:
> > > >
> > > > def options_for_association_conditions(association, record)
> > > >
> > > >
> > > >
> > > > if association.name == :city
> > > >
> > > >
> > > >
> > > > {:postal_code => record.postal_code}
> > > >
> > > >
> > > >
> > > > else
> > > >
> > > >
> > > >
> > > > super
> > > >
> > > >
> > > >
> > > > end
> > > >
> > > >
> > > >
> > > > end
> > > >
> > > >
> > > >
> > > >
> > > >
> > > >
> > > >
> > > > Then, set update_columns on postal_code to update city column:
> > > >
> > > >
> > > >
> > > > config.columns[:postal_code].update_columns = [:city]
> > > >
> > > >
> > > >
> > > >
> > > >
> > > >
> > > >
> > > > When postal code is changed, record on
> >
> > options_for_association_conditions
> >
> > > > will have only postal_code set, if you need to filter by some other
> > > >
> > > > columns, you will have to enable sending whole form when column
> >
> > changes:
> > > > config.columns[:postal_code].send_form_on_update_column = true
> > > >
> > > > El Martes, 2 de junio de 2015 07:10:05 Gloufy escribió:
> > > > > Re hi,
> > > > >
> > > > >
> > > > >
> > > > >
> > > > >
> > > > >
> > > > >
> > > > > I try to chaining form :
> > > > >
> > > > >
> > > > >
> > > > > I've got postal code field in text, when i finish i want a drop down
> > > > >
> > > > > with
> > > > >
> > > > >
> > > > >
> > > > > only the city which have the same postal code (in france a postal
> >
> > code
> >
> > > > have
> > > >
> > > > > many cities)
> > > > >
> > > > >
> > > > >
> > > > > How i can do it the dropdown update with only the right list form
> >
> > text
> >
> > > > > field?
> > > > >
> > > > >
> > > > >
> > > > > Thank you so much for your Help Sergio !
> > > > >
--
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.