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
    
  • .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'
    
  • <%= 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 -%>

Saved Queries

IDTitlePriorityStatusProject NameArchivedAdded

21-40 / 500 show all
171qui est etHighAssignedUltimate WebsiteNo2015-04-09 12:37:21Edit
187quodLowAssignedDivine FirmwareNo2015-03-31 12:37:21Edit
188aliquid adipisciAssignedUltimate WebsiteNo2015-05-21 12:37:21Edit
194quoUrgentAssignedUltimate WebsiteNo2015-03-26 12:37:21Edit
205velAnecdoticAssignedUltimate WebsiteNo2015-05-15 12:37:21Edit
232eos quam doloremLowAssignedUltimate WebsiteNo2015-06-18 12:37:22Edit
235sunt ametAssignedUltimate WebsiteNo2015-05-20 12:37:22Edit
245iure utNormalAssignedDivine FirmwareNo2015-06-01 12:37:22Edit
249sint itaqueUrgentAssignedSuper GameYes2015-06-16 12:37:22Edit
256saepeAnecdoticAssignedDivine FirmwareNo2015-05-04 12:37:22Edit
270modi minusNormalAssignedSuper GameNo2015-05-04 12:37:22Edit
273veroHighAssignedSuper GameYes2015-05-11 12:37:22Edit
279et sitLowAssignedSuper GameNo2015-06-01 12:37:23Edit
297dolores magnam eosAnecdoticAssignedSuper GameNo2015-03-12 12:37:23Edit
302eligendi velNormalAssignedSuper GameNo2015-03-24 12:37:23Edit
312repellendus perferendis vitaeLowAssignedSuper GameNo2015-05-17 12:37:23Edit
277magni officia inciduntNormalAssignedDivine FirmwareNo2015-06-13 12:37:23Edit
179omnis et facilisLowAssignedDivine FirmwareNo2015-03-29 12:37:21Edit
210molestiaeHighAssignedSuper GameNo2015-06-10 12:37:22Edit
173etHighAssignedSuper GameNo2015-03-29 12:37:21Edit

Fork me on GitHub