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


:
:
1-20 / 500 show all
157rerumNo2016-04-132015-06-12 12:37:212015-06-20 12:37:21
209fugaYes2016-03-012015-04-24 12:37:222015-06-20 12:37:22
216nihil vitae eaNo2016-04-092015-04-22 12:37:222015-06-20 12:37:22
239nesciuntNo2016-08-072015-05-30 12:37:222015-06-20 12:37:22
287sint non dolorNo2016-05-102015-05-07 12:37:232015-06-20 12:37:23
324natus dicta possimusNo2016-06-042015-05-16 12:37:232015-06-20 12:37:23
437atNo2016-02-292015-06-03 12:37:252015-06-20 12:37:25
207sunt laborum cupiditateNo2016-05-232015-04-13 12:37:212015-06-21 12:37:21
465totamNo2016-03-142015-04-23 12:37:262015-06-21 12:37:26
59alias liberoNo2016-01-092015-03-23 12:37:192015-06-22 12:37:19
383omnis vel delectusNo2016-02-172015-05-16 12:37:242015-06-22 12:37:24
412nonNo2016-03-212015-03-17 12:37:252015-06-22 12:37:25
492sed atNo2016-06-142015-05-13 12:37:272015-06-22 12:37:27
103molestiaeNo2016-04-012015-06-08 12:37:202015-06-23 12:37:20
176vitae ducimus consequunturNo2016-05-252015-04-25 12:37:212015-06-23 12:37:21
219corrupti magni voluptatemNo2016-04-222015-05-05 12:37:222015-06-23 12:37:22
374voluptatem saepeNo2016-03-242015-04-01 12:37:242015-06-23 12:37:24
395quia nobis quidemNo2016-05-232015-05-24 12:37:242015-06-23 12:37:24
86adipisciNo2016-02-072015-04-08 12:37:202015-06-24 12:37:20
89provident consequatur remNo2016-08-202015-03-30 12:37:202015-06-24 12:37:20

Fork me on GitHub