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


:
:
401-420 / 500 Sýna allt
401cum deserunt nesciuntYes2016-03-042015-05-18 12:37:252015-07-03 12:37:25
402atNo2016-04-292015-06-01 12:37:252015-08-16 12:37:25
403et praesentium temporeNo2016-10-202015-05-01 12:37:252015-07-29 12:37:25
404at aliquam corruptiNo2016-01-272015-05-23 12:37:252015-07-10 12:37:25
405magni excepturiNo2016-10-192015-05-31 12:37:252015-09-17 12:37:25
406sequi beataeNo2016-01-212015-04-26 12:37:252015-08-08 12:37:25
407similique voluptatumNo2016-10-052015-05-08 12:37:252015-08-06 12:37:25
408quibusdam voluptateNo2016-04-162015-04-10 12:37:252015-07-09 12:37:25
409dolore etNo2016-05-022015-03-12 12:37:252015-08-02 12:37:25
410et qui sintNo2016-05-142015-04-11 12:37:252015-09-07 12:37:25
411iureNo2016-02-232015-03-21 12:37:252015-07-19 12:37:25
412nonNo2016-03-212015-03-17 12:37:252015-06-22 12:37:25
413voluptateNo2016-03-102015-03-25 12:37:252015-09-25 12:37:25
414quo architecto nonYes2016-01-072015-05-19 12:37:252015-07-17 12:37:25
415voluptatemNo2016-06-162015-04-17 12:37:252015-07-29 12:37:25
416ipsamYes2016-07-142015-04-28 12:37:252015-08-22 12:37:25
417provident eumNo2016-01-142015-05-26 12:37:252015-09-01 12:37:25
418cupiditate ut illumNo2016-10-242015-05-27 12:37:252015-08-02 12:37:25
419voluptatem rerumYes2016-01-242015-04-21 12:37:252015-07-20 12:37:25
420rem nequeNo2016-06-142015-04-14 12:37:252015-08-09 12:37:25

Fork me on GitHub