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


:
:
161-180 / 500 Alle rijen tonen
161autNo2016-04-252015-06-19 12:37:212015-07-22 12:37:21
162quia nihil laboreNo2016-03-192015-04-19 12:37:212015-08-21 12:37:21
163ipsa quoNo2016-09-132015-04-11 12:37:212015-07-21 12:37:21
164beatae consecteturNo2016-02-292015-06-07 12:37:212015-09-16 12:37:21
165expeditaNo2016-02-132015-05-12 12:37:212015-09-27 12:37:21
166ut exNo2016-05-132015-05-06 12:37:212015-09-26 12:37:21
167enimNo2016-03-012015-03-28 12:37:212015-09-14 12:37:21
168adNo2016-10-062015-04-25 12:37:212015-08-06 12:37:21
169vitae oditNo2016-06-262015-06-07 12:37:212015-07-01 12:37:21
170fugiatNo2016-03-312015-04-20 12:37:212015-09-12 12:37:21
171qui est etNo2016-01-082015-04-09 12:37:212015-08-21 12:37:21
172nihil ipsamNo2016-04-082015-04-22 12:37:212015-09-09 12:37:21
173etNo2016-02-122015-03-29 12:37:212015-09-15 12:37:21
174ipsa quia voluptasNo2016-07-042015-04-18 12:37:212015-07-20 12:37:21
175aperiam omnisNo2016-04-172015-05-02 12:37:212015-07-17 12:37:21
176vitae ducimus consequunturNo2016-05-252015-04-25 12:37:212015-06-23 12:37:21
177ex perferendis velitNo2016-08-022015-03-18 12:37:212015-08-02 12:37:21
178molestias voluptas quiNo2016-01-112015-04-14 12:37:212015-08-14 12:37:21
179omnis et facilisNo2016-04-162015-03-29 12:37:212015-09-09 12:37:21
180cupiditate tenetur omnisNo2016-02-092015-06-17 12:37:212015-06-28 12:37:21

Fork me on GitHub