On Miércoles, 10 de Febrero de 2010 13:50:17 joelkeepup escribió:
> Hi, is there a way to do this without overriding the whole form?
>
> thanks
> Joel
You can set weights to columns, default weight for all columns is 0, columns
are ordered in ascending order, so -10 weight goes before 0 weights. When you
access to config.action.columns (to add or exclude columns for example),
columns are copied from config.columns, so set your weights before adding or
excluding columns from specific actions.
For example, a model has columns name, surname, birthday, email and phone.
Default columns order is birthday, email, name, phone, surname. To set name
and surname as first fields, and add a virtual column to list action, you can
use:
config.columns << :age #create a virtual column
config.columns.exclude :age # exclude from all actions
config.columns[:name].weight = -100
config.columns[:surname].weight = -50
config.list.columns << :age # add to list columns
If you want age column next to birthday, and you don't want to set a fixed
array for config.list.columns, you can exclude age for each action.
config.columns << :age #create a virtual column
config.columns[:name].weight = -100
config.columns[:surname].weight = -50
config.columns[:birthday].weight = -25
config.columns[:age].weight = -20
config.actions.each {|action| config.send(action).columns.exclude :age unless
action == :list }
--
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.