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


:
:
461-480 / 500 Sýna allt
461dolor voluptasNo2016-06-062015-06-05 12:37:262015-08-06 12:37:26
462provident doloremque laudantiumNo2016-01-222015-03-14 12:37:262015-09-04 12:37:26
463excepturiNo2016-08-222015-03-18 12:37:262015-07-23 12:37:26
464culpaNo2016-04-172015-05-23 12:37:262015-09-05 12:37:26
465totamNo2016-03-142015-04-23 12:37:262015-06-21 12:37:26
466autNo2016-03-212015-03-19 12:37:262015-07-08 12:37:26
467in error praesentiumNo2016-02-042015-05-12 12:37:262015-08-12 12:37:26
468officiisNo2016-02-282015-06-07 12:37:262015-08-20 12:37:26
469natus autemYes2016-10-082015-06-10 12:37:262015-07-29 12:37:26
470et nonNo2016-07-252015-06-19 12:37:262015-06-27 12:37:26
471illo ut evenietNo2016-05-092015-04-01 12:37:262015-06-24 12:37:26
472perspiciatisNo2016-03-132015-03-26 12:37:262015-09-09 12:37:26
473voluptatum quiNo2016-03-222015-06-11 12:37:262015-09-21 12:37:26
474possimusNo2016-06-302015-03-23 12:37:262015-08-16 12:37:26
475rerum perspiciatis eumNo2016-06-252015-04-20 12:37:262015-07-20 12:37:26
476facere voluptasYes2016-03-142015-05-21 12:37:262015-07-13 12:37:26
477et corruptiNo2016-06-102015-05-03 12:37:262015-09-14 12:37:26
478necessitatibusNo2016-03-172015-05-10 12:37:262015-07-20 12:37:26
479provident exNo2016-10-252015-05-02 12:37:262015-07-04 12:37:26
480quas sapiente rerumNo2016-07-102015-04-25 12:37:262015-08-02 12:37:26

Fork me on GitHub