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


:
:
141-160 / 500 Alle rijen tonen
141excepturiNo2016-02-142015-04-14 12:37:202015-09-08 12:37:20
142maxime accusamus consecteturNo2016-08-062015-05-31 12:37:202015-08-24 12:37:20
143et qui etNo2016-07-202015-04-02 12:37:202015-09-26 12:37:20
144est errorNo2016-07-092015-04-15 12:37:202015-07-12 12:37:20
145asperioresNo2016-10-082015-06-05 12:37:202015-06-26 12:37:20
146adipisci etYes2016-03-012015-04-06 12:37:212015-08-24 12:37:21
147adipisci ut asperioresNo2016-08-242015-03-29 12:37:212015-08-09 12:37:21
148porro ducimus voluptatibusNo2016-02-122015-03-18 12:37:212015-08-06 12:37:21
149omnis errorNo2016-07-112015-03-12 12:37:212015-07-07 12:37:21
150qui remNo2016-02-022015-06-01 12:37:212015-08-20 12:37:21
151ullam labore architectoNo2016-06-302015-03-24 12:37:212015-09-17 12:37:21
152nihilNo2016-02-152015-03-19 12:37:212015-09-27 12:37:21
153facilis utNo2016-01-232015-04-15 12:37:212015-07-14 12:37:21
154nostrumNo2016-05-152015-06-06 12:37:212015-07-25 12:37:21
155perferendis utNo2016-06-142015-05-10 12:37:212015-09-17 12:37:21
156rationeNo2016-10-172015-06-14 12:37:212015-06-24 12:37:21
157rerumNo2016-04-132015-06-12 12:37:212015-06-20 12:37:21
158aut voluptatibus autNo2016-08-192015-04-12 12:37:212015-07-09 12:37:21
159ut maioresNo2016-01-172015-05-09 12:37:212015-06-26 12:37:21
160aut voluptatesNo2016-04-142015-03-20 12:37:212015-08-09 12:37:21

Fork me on GitHub