The Controller:
def five
@grid = Grillo.new(
:pages=>pages_options(:pages_label=>'P\xc3\xa1gina %s de %s'),
:search=>search_options,
:order=>order_options,
:title=>"Registro de Llamadas"
)
@grid .add_column("calldate", :header=>'Fecha', :type=>:short_date, :orderable=>true)
@grid .add_column("clid", :header=>'Origen', :type=>:phone, :searchable=>true, :orderable=>true)
@grid .add_column("dst", :header=>'Destino', :type=>:phone, :searchable=>true)
@grid .add_column("duration", :header=>'Duración', :searchable=>true,
:format=>'%s [min]', :type=>:number, :sql_select=>" duration/60 ")
@grid .add_column("dstchannel", :header=>'Canal')
@grid .add_column("disposition", :header=>'Estado', :searchable=>true)
@grid .add_column("lastapp", :header=>'Comando')
@grid.fill_from_database(Cdr, :conditions=>"src!='' and duration>'25'")
end
The View:
<%= render_grillo @grid %>
The usage of some grillo properties, enabling ordering, search and pagination. The label of the pages is getting changed from the default value. Produces de following output: