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
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 | Title | Archived | Due Date | Added | Updated | |
---|---|---|---|---|---|---|
—
:
— : | ||||||
1-20 / 500 Sýna allt | ||||||
1 | impedit aperiam libero | No | 2016-07-27 | 2015-05-22 12:37:18 | 2015-08-18 12:37:18 | |
2 | ut sint | No | 2016-10-21 | 2015-04-09 12:37:18 | 2015-09-25 12:37:18 | |
3 | aliquam repudiandae | No | 2016-04-20 | 2015-03-21 12:37:18 | 2015-06-26 12:37:18 | |
4 | nisi qui | No | 2016-05-16 | 2015-03-18 12:37:18 | 2015-07-12 12:37:18 | |
5 | dicta pariatur | No | 2016-03-04 | 2015-04-19 12:37:18 | 2015-07-02 12:37:18 | |
6 | molestiae autem | Yes | 2016-10-26 | 2015-05-16 12:37:18 | 2015-09-07 12:37:18 | |
7 | ut veniam | No | 2016-08-04 | 2015-05-10 12:37:18 | 2015-09-13 12:37:18 | |
8 | nulla | No | 2016-05-22 | 2015-04-25 12:37:18 | 2015-09-23 12:37:18 | |
9 | quisquam in iste | No | 2016-03-07 | 2015-06-07 12:37:18 | 2015-08-25 12:37:18 | |
10 | rerum occaecati | No | 2016-08-14 | 2015-05-22 12:37:18 | 2015-08-22 12:37:18 | |
11 | aspernatur est | Yes | 2016-06-21 | 2015-03-24 12:37:18 | 2015-08-10 12:37:18 | |
12 | explicabo hic | No | 2016-04-15 | 2015-05-26 12:37:18 | 2015-07-20 12:37:18 | |
13 | ut | No | 2016-07-18 | 2015-03-22 12:37:18 | 2015-09-06 12:37:18 | |
14 | repellat consequatur velit | No | 2016-01-10 | 2015-05-06 12:37:18 | 2015-06-27 12:37:18 | |
15 | est ut aut | No | 2016-10-30 | 2015-04-17 12:37:18 | 2015-08-03 12:37:18 | |
16 | omnis | No | 2016-02-05 | 2015-03-21 12:37:18 | 2015-08-25 12:37:18 | |
17 | itaque suscipit commodi | No | 2016-08-23 | 2015-03-30 12:37:18 | 2015-08-23 12:37:18 | |
18 | necessitatibus commodi | No | 2016-03-28 | 2015-03-27 12:37:18 | 2015-06-29 12:37:18 | |
19 | id rem ea | Yes | 2016-04-14 | 2015-03-29 12:37:18 | 2015-09-22 12:37:18 | |
20 | aspernatur eligendi adipisci | No | 2016-06-08 | 2015-05-30 12:37:18 | 2015-08-30 12:37:18 |