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'
IDTitleArchived Due DateAddedUpdated


:
:
1-20 / 500 show all
22etNo2016-08-282015-05-19 12:37:192015-09-06 12:37:19
1impedit aperiam liberoNo2016-07-272015-05-22 12:37:182015-08-18 12:37:18
21et rerum laborumNo2016-04-292015-03-19 12:37:182015-08-04 12:37:18
2ut sintNo2016-10-212015-04-09 12:37:182015-09-25 12:37:18
3aliquam repudiandaeNo2016-04-202015-03-21 12:37:182015-06-26 12:37:18
7ut veniamNo2016-08-042015-05-10 12:37:182015-09-13 12:37:18
8nullaNo2016-05-222015-04-25 12:37:182015-09-23 12:37:18
4nisi quiNo2016-05-162015-03-18 12:37:182015-07-12 12:37:18
10rerum occaecatiNo2016-08-142015-05-22 12:37:182015-08-22 12:37:18
5dicta pariaturNo2016-03-042015-04-19 12:37:182015-07-02 12:37:18
12explicabo hicNo2016-04-152015-05-26 12:37:182015-07-20 12:37:18
13utNo2016-07-182015-03-22 12:37:182015-09-06 12:37:18
14repellat consequatur velitNo2016-01-102015-05-06 12:37:182015-06-27 12:37:18
15est ut autNo2016-10-302015-04-17 12:37:182015-08-03 12:37:18
16omnisNo2016-02-052015-03-21 12:37:182015-08-25 12:37:18
17itaque suscipit commodiNo2016-08-232015-03-30 12:37:182015-08-23 12:37:18
18necessitatibus commodiNo2016-03-282015-03-27 12:37:182015-06-29 12:37:18
9quisquam in isteNo2016-03-072015-06-07 12:37:182015-08-25 12:37:18
20aspernatur eligendi adipisciNo2016-06-082015-05-30 12:37:182015-08-30 12:37:18
23exercitationem autNo2016-05-212015-04-23 12:37:192015-09-13 12:37:19

Fork me on GitHub