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


:
:
41-60 / 500 Alle rijen tonen
41estNo2016-04-092015-04-10 12:37:192015-07-29 12:37:19
42autNo2016-08-252015-04-08 12:37:192015-09-05 12:37:19
43impedit atque minimaYes2016-08-152015-06-03 12:37:192015-06-29 12:37:19
44id temporibus eligendiNo2016-03-112015-03-27 12:37:192015-07-26 12:37:19
45rerumNo2016-03-062015-06-15 12:37:192015-08-06 12:37:19
46facereYes2016-09-212015-04-26 12:37:192015-08-31 12:37:19
47temporibus iure delectusNo2016-02-112015-04-22 12:37:192015-09-25 12:37:19
48qui inciduntNo2016-08-022015-04-04 12:37:192015-08-04 12:37:19
49laborumNo2016-09-282015-04-30 12:37:192015-08-01 12:37:19
50ipsum nam temporeNo2016-03-232015-04-10 12:37:192015-08-07 12:37:19
51harum qui possimusNo2016-08-242015-04-26 12:37:192015-09-20 12:37:19
52eos temporibus omnisNo2016-05-232015-03-13 12:37:192015-09-05 12:37:19
53molestiaeNo2016-06-042015-04-21 12:37:192015-07-10 12:37:19
54minima in voluptatemNo2016-10-042015-05-29 12:37:192015-08-01 12:37:19
55dolorNo2016-04-102015-06-11 12:37:192015-07-15 12:37:19
56sitNo2016-09-102015-05-11 12:37:192015-09-14 12:37:19
57nequeNo2016-05-242015-03-19 12:37:192015-08-28 12:37:19
58atque etNo2016-03-292015-05-28 12:37:192015-08-15 12:37:19
59alias liberoNo2016-01-092015-03-23 12:37:192015-06-22 12:37:19
60voluptas repellendusNo2016-05-022015-06-02 12:37:192015-09-11 12:37:19

Fork me on GitHub