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


:
:
481-500 / 500 show all
481etNo2016-10-232015-06-05 12:37:262015-08-25 12:37:26
482consequuntur eumNo2016-06-052015-05-01 12:37:262015-08-16 12:37:26
483laborum dictaNo2016-02-282015-05-09 12:37:262015-08-06 12:37:26
484quiaNo2016-05-312015-05-06 12:37:262015-07-26 12:37:26
485ut teneturNo2016-10-132015-06-10 12:37:262015-08-09 12:37:26
486enim harum minimaNo2016-09-252015-04-18 12:37:262015-07-18 12:37:26
487natus etNo2016-01-312015-05-14 12:37:262015-09-08 12:37:26
488doloribus veritatisNo2016-04-062015-06-17 12:37:262015-09-04 12:37:26
489voluptatemNo2016-01-312015-06-02 12:37:272015-07-14 12:37:27
490maximeNo2016-04-102015-05-21 12:37:272015-08-13 12:37:27
491modi nesciuntNo2016-05-102015-05-04 12:37:272015-09-26 12:37:27
492sed atNo2016-06-142015-05-13 12:37:272015-06-22 12:37:27
493estNo2016-02-062015-05-28 12:37:272015-07-09 12:37:27
494fugiat quaeratNo2016-06-102015-05-30 12:37:272015-08-10 12:37:27
495qui ut inNo2016-10-082015-04-21 12:37:272015-07-27 12:37:27
496velit non pariaturYes2016-09-062015-04-07 12:37:272015-07-28 12:37:27
497impedit quoNo2016-07-092015-04-11 12:37:272015-09-11 12:37:27
498sedYes2016-07-072015-04-05 12:37:272015-08-08 12:37:27
499voluptatemNo2016-06-192015-05-09 12:37:272015-09-17 12:37:27
500vel eaYes2016-03-302015-04-16 12:37:272015-07-11 12:37:27

Fork me on GitHub