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


:
:
381-400 / 500 Alle rijen tonen
381eosNo2016-05-122015-05-12 12:37:242015-07-17 12:37:24
382vel nostrumNo2016-07-192015-06-14 12:37:242015-08-22 12:37:24
383omnis vel delectusNo2016-02-172015-05-16 12:37:242015-06-22 12:37:24
384quiaNo2016-03-122015-05-27 12:37:242015-09-22 12:37:24
385et teneturNo2016-09-062015-04-13 12:37:242015-08-16 12:37:24
386eveniet ipsam etNo2016-07-262015-03-28 12:37:242015-07-18 12:37:24
387sedNo2016-07-102015-03-27 12:37:242015-07-25 12:37:24
388aspernatur dolores velNo2016-02-272015-05-26 12:37:242015-08-21 12:37:24
389utNo2016-07-232015-05-28 12:37:242015-08-30 12:37:24
390voluptas ut etNo2016-05-012015-03-15 12:37:242015-07-07 12:37:24
391aut estNo2016-10-212015-03-12 12:37:242015-09-10 12:37:24
392velit vitaeNo2016-08-272015-05-16 12:37:242015-07-15 12:37:24
393nihilYes2016-06-182015-04-18 12:37:242015-09-24 12:37:24
394minus facilisNo2016-08-042015-03-28 12:37:242015-07-12 12:37:24
395quia nobis quidemNo2016-05-232015-05-24 12:37:242015-06-23 12:37:24
396at consequatur quaeratNo2016-02-242015-03-29 12:37:242015-09-24 12:37:24
397tempore ut aliquidYes2016-07-012015-06-05 12:37:242015-08-18 12:37:24
398dolores sitNo2016-09-202015-03-29 12:37:252015-06-27 12:37:25
399rerum quaeNo2016-03-242015-04-16 12:37:252015-07-27 12:37:25
400et voluptatibusNo2016-08-152015-04-23 12:37:252015-09-11 12:37:25

Fork me on GitHub