Sha256: 82d889cee2fd851d55d6def8fe3955d0f0b7219c4b3ae8d56890de144998a44c
Contents?: true
Size: 1.19 KB
Versions: 2
Compression:
Stored size: 1.19 KB
Contents
class ApplicationController < ActionController::Base protect_from_forgery def index #Project.destroy_all if Project.count < 10 10.times do |i| proj = Project.create :title => "Project #{i}" 3.times do proj.tickets.create! end end end projects_grid = fancygrid_for :projects, :builder => MyGrid, :persist => true do |grid| grid.ajax_url = "/index.html" grid.paginate = request.format.html? grid.select = true grid.find do |q| q.includes :tickets end end respond_to do |format| format.html { render } format.json { render :json => projects_grid.records } format.xml { render :xml => projects_grid.dump_records } end end end class MyGrid < Fancygrid::Grid def apply_options(options) super self.attributes :id, :title self.columns :hash, :object_id self.columns_for :tickets do |t| t.columns :id end #self.components -= [:search_bar] self.components += [:sort_window] #self.ajax_url = "/" self.ajax_type = :get self.search_filter "projects.title", [["-- choose --", ""], [:foo, :foo], [:bar, :bar]] end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
fancygrid-2.0.1 | spec/dummy/app/controllers/application_controller.rb |
fancygrid-2.0.0 | spec/dummy/app/controllers/application_controller.rb |