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


:
:
81-100 / 500 Voir tous
81ad quo dolorNo2016-05-182015-05-05 12:37:202015-08-31 12:37:20
82utNo2016-01-122015-06-04 12:37:202015-06-27 12:37:20
83enimNo2016-10-142015-03-14 12:37:202015-08-07 12:37:20
84doloreNo2016-05-282015-04-04 12:37:202015-07-15 12:37:20
85voluptatibus inventoreYes2016-06-032015-06-12 12:37:202015-06-28 12:37:20
86adipisciNo2016-02-072015-04-08 12:37:202015-06-24 12:37:20
87nostrumNo2016-03-312015-06-13 12:37:202015-08-15 12:37:20
88culpaNo2016-10-192015-05-25 12:37:202015-06-27 12:37:20
89provident consequatur remNo2016-08-202015-03-30 12:37:202015-06-24 12:37:20
90commodi et quisNo2016-05-302015-04-27 12:37:202015-08-24 12:37:20
91quaeratNo2016-06-172015-06-08 12:37:202015-07-07 12:37:20
92est praesentiumNo2016-01-192015-06-08 12:37:202015-09-19 12:37:20
93autNo2016-09-202015-04-04 12:37:202015-08-07 12:37:20
94officiisNo2016-02-012015-04-01 12:37:202015-08-10 12:37:20
95quibusdam beatae adYes2016-03-062015-05-05 12:37:202015-07-30 12:37:20
96impedit explicabo voluptatemNo2016-10-252015-06-02 12:37:202015-08-20 12:37:20
97voluptatem facilis etNo2016-05-262015-03-15 12:37:202015-07-20 12:37:20
98aperiam rerumYes2016-07-192015-05-31 12:37:202015-09-11 12:37:20
99solutaNo2016-10-122015-03-25 12:37:202015-08-16 12:37:20
100autem nonNo2016-08-042015-05-02 12:37:202015-07-24 12:37:20

Fork me on GitHub