WiceGrid 3.6.0.pre4 examples

Auto reloading filters (two grids on page)

An example with 2 independant autoreloading grids on one page.

  • # encoding: utf-8
    class AutoReloads3Controller < ApplicationController
      def index
        @tasks_grid = initialize_grid(Task,
          custom_order: {
            'tasks.priority_id' => 'priorities.name',
            'tasks.status_id' => 'statuses.position',
            'tasks.project_id' => 'projects.name'
          }
        )
        @tasks_grid2 = initialize_grid(Task,
         name: 'grid2',
         custom_order: {
           'tasks.priority_id' => 'priorities.name',
           'tasks.status_id' => 'statuses.position',
           'tasks.project_id' => 'projects.name'
         }
        )
      end
    end
    
  • <%= define_grid(grid,  hide_submit_button: true) do |g|
    
    
      g.column name:  'Title', attribute: 'title', auto_reload:  true, negation: true, detach_with_id: :title
    
      g.column name:  'Archived', attribute: 'archived', auto_reload:  true, detach_with_id: :archived do |rec|
        rec.archived? ? 'Yes' : 'No'
      end
    
    
      g.column name:  'Status', attribute: 'status_id', custom_filter: Status.to_dropdown, auto_reload:  true, detach_with_id: :status_id  do |task|
        task.status.name if task.status
      end
    
    
      g.column name:  'Due Date', attribute: 'due_date', auto_reload:  true, detach_with_id: :due_date do |task|
        task.due_date if task.due_date
      end
    
    
    
      g.column   do |task|
        link_to('Edit', edit_task_path(task))
      end
    end -%>
  • .well
      %h2= current_page_title
      %p
        An example with 2 independant autoreloading grids on one page.
    
    = show_code
    
    = render   'grid', grid: @tasks_grid
    = render   'grid', grid: @tasks_grid2
    
    
    .row-fluid
      .col-md-2
        Title:
      .col-md-4
        = grid_filter @tasks_grid, :title
    
      .col-md-2
        Title:
      .col-md-4
        = grid_filter @tasks_grid2, :title
    
    
    
    .row-fluid
      .col-md-2
        Archived:
      .col-md-4
        = grid_filter @tasks_grid, :archived
    
    
      .col-md-2
        Archived:
      .col-md-4
        = grid_filter @tasks_grid2, :archived
    
    
    
    .row-fluid
      .col-md-2
        Status:
      .col-md-4
        = grid_filter @tasks_grid, :status_id
    
      .col-md-2
        Status:
      .col-md-4
        = grid_filter @tasks_grid2, :status_id
    
    
    
    .row-fluid
      .col-md-2
        Due date:
      .col-md-4
        = grid_filter @tasks_grid, :due_date
    
      .col-md-2
        Due date:
      .col-md-4
        = grid_filter @tasks_grid2, :due_date
    
    
    .row-fluid
      .col-md-6
        .external-buttons.grid1
          %button.btn.btn-default.wg-external-reset-button{'data-grid-name' => 'grid'} Reset
    
      .col-md-6
        .external-buttons.grid2
          %button.btn.btn-default.wg-external-reset-button{'data-grid-name' => 'grid2'} Reset
    
    
    .row-fluid
      .col-md-6
        = render_grid(@tasks_grid)
      .col-md-6
        = render_grid(@tasks_grid2)
    
Title:
Title:
Archived:
Archived:
Status:
Status:
Due date:

Due date:

TitleArchivedStatusDue Date
1-20 / 500 Alle rijen tonen
impedit aperiam liberoNoCancelled2016-07-27Edit
ut sintNoAssigned2016-10-21Edit
aliquam repudiandaeNoAssigned2016-04-20Edit
nisi quiNoVerified2016-05-16Edit
dicta pariaturNoPostponed2016-03-04Edit
molestiae autemYesResolved2016-10-26Edit
ut veniamNoPostponed2016-08-04Edit
nullaNoResolved2016-05-22Edit
quisquam in isteNoDuplicate2016-03-07Edit
rerum occaecatiNoCancelled2016-08-14Edit
aspernatur estYesStarted2016-06-21Edit
explicabo hicNoPostponed2016-04-15Edit
utNoClosed2016-07-18Edit
repellat consequatur velitNoNew2016-01-10Edit
est ut autNoNew2016-10-30Edit
omnisNoAssigned2016-02-05Edit
itaque suscipit commodiNoStarted2016-08-23Edit
necessitatibus commodiNoStarted2016-03-28Edit
id rem eaYesVerified2016-04-14Edit
aspernatur eligendi adipisciNoAssigned2016-06-08Edit
TitleArchivedStatusDue Date
481-500 / 500 Alle rijen tonen
etNoClosed2016-10-23Edit
consequuntur eumNoDuplicate2016-06-05Edit
laborum dictaNoVerified2016-02-28Edit
quiaNoResolved2016-05-31Edit
ut teneturNoDuplicate2016-10-13Edit
enim harum minimaNoResolved2016-09-25Edit
natus etNoNew2016-01-31Edit
doloribus veritatisNoClosed2016-04-06Edit
voluptatemNoDuplicate2016-01-31Edit
maximeNoClosed2016-04-10Edit
modi nesciuntNoStarted2016-05-10Edit
sed atNoStarted2016-06-14Edit
estNoVerified2016-02-06Edit
fugiat quaeratNoDuplicate2016-06-10Edit
qui ut inNoVerified2016-10-08Edit
velit non pariaturYesPostponed2016-09-06Edit
impedit quoNoNew2016-07-09Edit
sedYesResolved2016-07-07Edit
voluptatemNoResolved2016-06-19Edit
vel eaYesStarted2016-03-30Edit

Fork me on GitHub