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'
ID TitleArchivedDue DateAddedUpdated


:
:
101-120 / 500 Alle rijen tonen
101enim ullamNo2016-07-122015-06-03 12:37:202015-08-31 12:37:20
102inventore eligendi voluptasNo2016-06-142015-06-11 12:37:202015-09-26 12:37:20
103molestiaeNo2016-04-012015-06-08 12:37:202015-06-23 12:37:20
104autemNo2016-05-232015-06-06 12:37:202015-07-31 12:37:20
105autem quiaYes2016-06-252015-04-09 12:37:202015-07-05 12:37:20
106laboriosam enimNo2016-09-122015-06-18 12:37:202015-08-31 12:37:20
107utNo2016-07-292015-04-02 12:37:202015-08-09 12:37:20
108maximeNo2016-09-012015-05-21 12:37:202015-08-08 12:37:20
109sit amet fugiatNo2016-02-082015-04-03 12:37:202015-06-29 12:37:20
110hicNo2016-01-112015-05-11 12:37:202015-09-12 12:37:20
111sit eaYes2016-04-072015-06-03 12:37:202015-08-17 12:37:20
112neque quiNo2016-02-252015-04-05 12:37:202015-07-19 12:37:20
113exercitationemNo2016-05-282015-04-02 12:37:202015-07-19 12:37:20
114dolores liberoNo2016-05-272015-06-08 12:37:202015-07-03 12:37:20
115sit et estNo2016-08-142015-03-16 12:37:202015-09-09 12:37:20
116dolorem consecteturNo2016-09-072015-05-17 12:37:202015-07-24 12:37:20
117fugitNo2016-02-122015-04-02 12:37:202015-08-24 12:37:20
118hicNo2016-06-072015-03-25 12:37:202015-07-04 12:37:20
119quo est aliquidNo2016-03-222015-05-19 12:37:202015-09-01 12:37:20
120esse voluptas deseruntNo2016-08-012015-05-07 12:37:202015-07-06 12:37:20

Fork me on GitHub