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


:
:
421-440 / 500 show all
421reiciendis dolorum quodYes2016-05-282015-04-11 12:37:252015-09-19 12:37:25
422harum enimNo2016-07-142015-04-25 12:37:252015-09-11 12:37:25
423magni eosNo2016-10-152015-05-13 12:37:252015-08-26 12:37:25
424non autem solutaNo2016-01-142015-06-01 12:37:252015-06-24 12:37:25
425nulla quoNo2016-04-302015-03-24 12:37:252015-06-24 12:37:25
426accusantium eligendiNo2016-09-012015-04-29 12:37:252015-09-17 12:37:25
427quae assumendaNo2016-10-092015-05-15 12:37:252015-08-17 12:37:25
428commodi omnis temporeNo2016-10-052015-03-18 12:37:252015-07-01 12:37:25
429ipsamNo2016-03-172015-04-30 12:37:252015-08-20 12:37:25
430enim itaqueNo2016-07-252015-05-11 12:37:252015-08-22 12:37:25
431vitae repudiandaeNo2016-05-212015-05-30 12:37:252015-09-07 12:37:25
432magni temporeNo2016-04-172015-03-26 12:37:252015-09-15 12:37:25
433ut facereNo2016-02-212015-05-15 12:37:252015-07-15 12:37:25
434voluptas quisquamNo2016-09-162015-04-20 12:37:252015-09-20 12:37:25
435eos deseruntNo2016-05-272015-04-20 12:37:252015-08-04 12:37:25
436accusantiumNo2016-10-012015-04-05 12:37:252015-07-12 12:37:25
437atNo2016-02-292015-06-03 12:37:252015-06-20 12:37:25
438undeNo2016-09-072015-04-26 12:37:252015-07-07 12:37:25
439namNo2016-05-292015-05-23 12:37:252015-09-03 12:37:25
440ut quae atNo2016-05-122015-04-29 12:37:252015-09-14 12:37:25

Fork me on GitHub