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 -%>
IDTitleArchivedDue DateAdded Updated


:
:
1-20 / 500 Alle rijen tonen
80corrupti officiaNo2016-09-292015-03-12 12:37:192015-07-13 12:37:19
149omnis errorNo2016-07-112015-03-12 12:37:212015-07-07 12:37:21
206quia ipsum maximeNo2016-01-092015-03-12 12:37:212015-09-03 12:37:21
257et nihilNo2016-04-142015-03-12 12:37:222015-06-30 12:37:22
269culpa assumendaNo2016-06-152015-03-12 12:37:222015-08-03 12:37:22
297dolores magnam eosNo2016-01-252015-03-12 12:37:232015-09-15 12:37:23
391aut estNo2016-10-212015-03-12 12:37:242015-09-10 12:37:24
409dolore etNo2016-05-022015-03-12 12:37:252015-08-02 12:37:25
52eos temporibus omnisNo2016-05-232015-03-13 12:37:192015-09-05 12:37:19
318beataeNo2016-03-192015-03-13 12:37:232015-07-06 12:37:23
83enimNo2016-10-142015-03-14 12:37:202015-08-07 12:37:20
136exercitationem distinctio quiNo2016-04-012015-03-14 12:37:202015-08-01 12:37:20
233nesciunt suscipit quisYes2016-05-232015-03-14 12:37:222015-09-22 12:37:22
454similique enim odioNo2016-01-112015-03-14 12:37:262015-08-30 12:37:26
462provident doloremque laudantiumNo2016-01-222015-03-14 12:37:262015-09-04 12:37:26
27eum velNo2016-05-292015-03-15 12:37:192015-07-03 12:37:19
62eum velit saepeNo2016-10-182015-03-15 12:37:192015-08-20 12:37:19
97voluptatem facilis etNo2016-05-262015-03-15 12:37:202015-07-20 12:37:20
390voluptas ut etNo2016-05-012015-03-15 12:37:242015-07-07 12:37:24
115sit et estNo2016-08-142015-03-16 12:37:202015-09-09 12:37:20

Fork me on GitHub