WiceGrid 3.6.0.pre4 examples

Date/Datetime helpers

WiceGrid provides four filters for selecting dates and time:

  • :jquery_datepicker - Jquery datepicker (works for datetime, too)
  • :bootstrap_datepicker - Bootstrap datepicker (works for datetime, too)
  • :rails_date_helper - standard Rails date helper
  • :rails_datetime_helper - standard Rails datetime helper
Specify a date/datetime filter just like you specify any other filter:

Default filters are defined in configuration constants Wice::Defaults::DEFAULT_FILTER_FOR_DATE and Wice::Defaults::DEFAULT_FILTER_FOR_DATETIME. By default :jquery_datepicker is used for both dates and time.

  • # encoding: utf-8
    class DatesController < ApplicationController
      def index
        @tasks_grid = initialize_grid(Task,
          order: 'id'
        )
      end
    end
    
  • .well
      %h2= current_page_title
      %p
        WiceGrid provides four filters for selecting dates and time:
    
        %ul
          %li
            %code
              \:jquery_datepicker
            \- Jquery datepicker (works for datetime, too)
    
          %li
            %code
              \:bootstrap_datepicker
            \- Bootstrap datepicker (works for datetime, too)
    
          %li
            %code
              \:rails_date_helper
            \- standard Rails date helper
    
          %li
            %code
              \:rails_datetime_helper
            \- standard Rails datetime helper
    
        Specify a date/datetime filter just like you specify any other filter:
    
    
      %p
        Default filters are defined in configuration constants
        %code
          Wice::Defaults::DEFAULT_FILTER_FOR_DATE
        and
        %code
          Wice::Defaults::DEFAULT_FILTER_FOR_DATETIME.
        By default
        %code
          \:jquery_datepicker
        is used for both dates and time.
    
    
    
    
    
    
    
    = show_code
    
    .row-fluid
      .col-md-12
        = render   'grid'
  • 
    <%= grid(@tasks_grid) do |g|
    
      g.column name:  'ID', attribute: 'id', filter: false
    
      g.column name:  'Title', attribute: 'title'
    
      g.column  name:  'Archived', attribute: 'archived' do |task|
        task.archived? ? 'Yes' : 'No'
      end
    
      g.column name:  'Due Date', attribute: 'due_date' do |task|
        task.due_date if task.due_date
      end
    
      g.column name:  'Added', attribute: 'created_at' do |task|
        task.created_at.to_s(:db)
      end
    
      g.column name:  'Updated', attribute: 'updated_at', filter_type: :rails_datetime_helper do |task|
        task.updated_at.to_s(:db)
      end
    
    
    end -%>
IDTitle ArchivedDue DateAddedUpdated


:
:
1-20 / 500 show all
25ab quiNo2016-05-032015-05-29 12:37:192015-08-25 12:37:19
63accusamusNo2016-09-172015-04-15 12:37:192015-09-10 12:37:19
436accusantiumNo2016-10-012015-04-05 12:37:252015-07-12 12:37:25
426accusantium eligendiNo2016-09-012015-04-29 12:37:252015-09-17 12:37:25
370accusantium error exercitationemNo2016-01-242015-04-25 12:37:242015-07-04 12:37:24
168adNo2016-10-062015-04-25 12:37:212015-08-06 12:37:21
86adipisciNo2016-02-072015-04-08 12:37:202015-06-24 12:37:20
346adipisci at nesciuntNo2016-10-142015-06-18 12:37:242015-07-28 12:37:24
146adipisci etYes2016-03-012015-04-06 12:37:212015-08-24 12:37:21
147adipisci ut asperioresNo2016-08-242015-03-29 12:37:212015-08-09 12:37:21
81ad quo dolorNo2016-05-182015-05-05 12:37:202015-08-31 12:37:20
59alias liberoNo2016-01-092015-03-23 12:37:192015-06-22 12:37:19
3aliquam repudiandaeNo2016-04-202015-03-21 12:37:182015-06-26 12:37:18
188aliquid adipisciNo2016-08-152015-05-21 12:37:212015-07-28 12:37:21
139aliquid oditNo2016-10-112015-04-19 12:37:202015-07-05 12:37:20
230aliquid rerum modiYes2016-07-202015-04-23 12:37:222015-07-20 12:37:22
215aliquid sed suntYes2016-07-292015-05-12 12:37:222015-07-05 12:37:22
79animiNo2016-05-062015-05-04 12:37:192015-08-24 12:37:19
447animi accusantium utNo2016-10-152015-04-06 12:37:262015-06-30 12:37:26
175aperiam omnisNo2016-04-172015-05-02 12:37:212015-07-17 12:37:21

Fork me on GitHub