Displaying 1 result from an estimated 1 matches for "datagrid_field".
Did you mean:
  datagrid_fields
  
2006 Mar 07
1
decorators for models?
...d happen automagically depending on the class name. There would 
be some default functions, like field_title that would return humanized 
column descriptions (i.e. order_status -> Order status)
This is how one such decorator could look like
class OrdersDecorator < ActiveRecord::Decorator
  @datagrid_fields=%w(id, name, country)
  def datagrid_field_title_id
    "Order ID"
  end
  def datagrid_row_style(m)
    ''big-order'' if m.total>100
  end
  def sort_country(a,b,direction)
   return a.continent<b.continet #sort countries by continent, not by 
name
  end
end
Wh...