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

81-100 / 500 Alle rijen tonen
186velit dignissimosCancelledUltimate WebsiteNo2015-04-11 12:37:21Edit
190recusandae nisi doloribusCancelledUltimate WebsiteNo2015-03-30 12:37:21Edit
200minusUrgentCancelledSuper GameNo2015-05-21 12:37:21Edit
204error earum quiHighCancelledUltimate WebsiteNo2015-04-12 12:37:21Edit
224quia illum natusNormalCancelledSuper GameNo2015-03-19 12:37:22Edit
229omnis commodiHighCancelledDivine FirmwareNo2015-04-08 12:37:22Edit
255qui suscipitCancelledUltimate WebsiteNo2015-04-24 12:37:22Edit
259suntCancelledDivine FirmwareNo2015-05-18 12:37:22Edit
267quoLowCancelledSuper GameNo2015-06-14 12:37:22Edit
280corporisHighCancelledUltimate WebsiteNo2015-05-13 12:37:23Edit
286excepturi deleniti corporisLowCancelledUltimate WebsiteNo2015-05-01 12:37:23Edit
315autemUrgentCancelledSuper GameNo2015-06-14 12:37:23Edit
341est cumUrgentCancelledDivine FirmwareNo2015-05-17 12:37:23Edit
342non similiqueCancelledDivine FirmwareNo2015-04-26 12:37:23Edit
354sedUrgentCancelledSuper GameNo2015-04-13 12:37:24Edit
230aliquid rerum modiHighCancelledUltimate WebsiteYes2015-04-23 12:37:22Edit
226ex aperiamCancelledSuper GameNo2015-05-08 12:37:22Edit
293sed est estNormalCancelledUltimate WebsiteYes2015-04-22 12:37:23Edit
269culpa assumendaHighCancelledDivine FirmwareNo2015-03-12 12:37:22Edit
227et voluptatibusHighCancelledDivine FirmwareNo2015-06-09 12:37:22Edit

Fork me on GitHub