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


:
:
61-80 / 500 Voir tous
61quia architectoNo2016-08-022015-05-15 12:37:192015-09-16 12:37:19
62eum velit saepeNo2016-10-182015-03-15 12:37:192015-08-20 12:37:19
63accusamusNo2016-09-172015-04-15 12:37:192015-09-10 12:37:19
64reiciendisNo2016-04-122015-03-30 12:37:192015-08-23 12:37:19
65eosYes2016-07-312015-04-21 12:37:192015-08-28 12:37:19
66vitae at autemNo2016-06-162015-05-06 12:37:192015-06-28 12:37:19
67officia quo maioresNo2016-10-052015-06-15 12:37:192015-08-02 12:37:19
68exercitationem delectusNo2016-10-012015-05-12 12:37:192015-09-03 12:37:19
69similique placeat ipsaNo2016-03-192015-05-08 12:37:192015-09-19 12:37:19
70autemNo2016-08-042015-03-25 12:37:192015-08-13 12:37:19
71atNo2016-07-132015-04-28 12:37:192015-08-24 12:37:19
72illum explicabo modiNo2016-05-272015-06-16 12:37:192015-07-17 12:37:19
73iure architectoNo2016-08-202015-04-05 12:37:192015-07-03 12:37:19
74molestiaeNo2016-03-052015-05-22 12:37:192015-08-11 12:37:19
75velit non magniNo2016-09-162015-05-07 12:37:192015-09-25 12:37:19
76totamNo2016-09-062015-03-31 12:37:192015-08-30 12:37:19
77sed quibusdam isteNo2016-06-182015-06-03 12:37:192015-07-04 12:37:19
78exercitationem sapienteNo2016-06-182015-04-07 12:37:192015-08-08 12:37:19
79animiNo2016-05-062015-05-04 12:37:192015-08-24 12:37:19
80corrupti officiaNo2016-09-292015-03-12 12:37:192015-07-13 12:37:19

Fork me on GitHub