WiceGrid 3.6.0.pre4 examples

Saved queries: simple example

Read SAVED_QUERIES_HOWTO.rdoc for details.

  • # encoding: utf-8
    class SavedQueriesController < ApplicationController
      def index
        @tasks_grid = initialize_grid(Task,
          include: [:priority, :status, :project, :assigned_users],
          order: 'statuses.name',
          custom_order: {
            'tasks.priority_id' => 'priorities.name',
            'tasks.status_id' => 'statuses.position',
            'tasks.project_id' => 'projects.name'
          }
        )
      end
    end
    
  • <%= grid(@tasks_grid, show_filters: :always) do |g|
    
      g.column name:  'ID', attribute: 'id', filter: false
    
      g.column name:  'Title', attribute: 'title'
    
      g.column name:  'Priority', attribute: 'priority_id', custom_filter: Priority.to_dropdown do |task|
        task.priority.name if task.priority
      end
    
      g.column name:  'Status', attribute: 'status_id', custom_filter: Status.to_dropdown  do |task|
        task.status.name if task.status
      end
    
      g.column name:  'Project Name', attribute: 'project_id', custom_filter: Project.to_dropdown do |task|
        task.project.name if task.project
      end
    
      g.column  name:  'Archived', attribute: 'archived' do |task|
        task.archived? ? 'Yes' : 'No'
      end
    
      g.column name:  'Added', attribute: 'created_at' do |task|
        task.created_at.to_s(:db)
      end
    
      g.column   do |task|
        link_to('Edit', edit_task_path(task))
      end
    end -%>
  • .well
      %h2= current_page_title
      %p
        Read
        %code SAVED_QUERIES_HOWTO.rdoc
        for details.
    
    = show_code
    
    .row-fluid
      .col-md-6
    
        = saved_queries_panel(@tasks_grid, confirm:  false)
    
    = render   'grid'
    

Opgeslagen query's

IDTitlePriorityStatusProject NameArchivedAdded

1-20 / 500 Alle rijen tonen
80corrupti officiaUrgentAssignedSuper GameNo2015-03-12 12:37:19Edit
149omnis errorAnecdoticDuplicateSuper GameNo2015-03-12 12:37:21Edit
206quia ipsum maximeVerifiedUltimate WebsiteNo2015-03-12 12:37:21Edit
257et nihilHighDuplicateSuper GameNo2015-03-12 12:37:22Edit
269culpa assumendaHighCancelledDivine FirmwareNo2015-03-12 12:37:22Edit
297dolores magnam eosAnecdoticAssignedSuper GameNo2015-03-12 12:37:23Edit
391aut estLowDuplicateUltimate WebsiteNo2015-03-12 12:37:24Edit
409dolore etNormalPostponedUltimate WebsiteNo2015-03-12 12:37:25Edit
52eos temporibus omnisLowResolvedSuper GameNo2015-03-13 12:37:19Edit
318beataeVerifiedDivine FirmwareNo2015-03-13 12:37:23Edit
83enimDuplicateDivine FirmwareNo2015-03-14 12:37:20Edit
136exercitationem distinctio quiCancelledDivine FirmwareNo2015-03-14 12:37:20Edit
233nesciunt suscipit quisNormalDuplicateUltimate WebsiteYes2015-03-14 12:37:22Edit
454similique enim odioUrgentDuplicateDivine FirmwareNo2015-03-14 12:37:26Edit
462provident doloremque laudantiumHighDuplicateUltimate WebsiteNo2015-03-14 12:37:26Edit
27eum velHighResolvedUltimate WebsiteNo2015-03-15 12:37:19Edit
62eum velit saepeNormalAssignedDivine FirmwareNo2015-03-15 12:37:19Edit
97voluptatem facilis etStartedDivine FirmwareNo2015-03-15 12:37:20Edit
390voluptas ut etLowClosedSuper GameNo2015-03-15 12:37:24Edit
115sit et estHighPostponedDivine FirmwareNo2015-03-16 12:37:20Edit

Fork me on GitHub