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 | |
---|---|---|---|---|---|---|
—
:
— : | ||||||
41-60 / 500 show all | ||||||
41 | est | No | 2016-04-09 | 2015-04-10 12:37:19 | 2015-07-29 12:37:19 | |
42 | aut | No | 2016-08-25 | 2015-04-08 12:37:19 | 2015-09-05 12:37:19 | |
43 | impedit atque minima | Yes | 2016-08-15 | 2015-06-03 12:37:19 | 2015-06-29 12:37:19 | |
44 | id temporibus eligendi | No | 2016-03-11 | 2015-03-27 12:37:19 | 2015-07-26 12:37:19 | |
45 | rerum | No | 2016-03-06 | 2015-06-15 12:37:19 | 2015-08-06 12:37:19 | |
46 | facere | Yes | 2016-09-21 | 2015-04-26 12:37:19 | 2015-08-31 12:37:19 | |
47 | temporibus iure delectus | No | 2016-02-11 | 2015-04-22 12:37:19 | 2015-09-25 12:37:19 | |
48 | qui incidunt | No | 2016-08-02 | 2015-04-04 12:37:19 | 2015-08-04 12:37:19 | |
49 | laborum | No | 2016-09-28 | 2015-04-30 12:37:19 | 2015-08-01 12:37:19 | |
50 | ipsum nam tempore | No | 2016-03-23 | 2015-04-10 12:37:19 | 2015-08-07 12:37:19 | |
51 | harum qui possimus | No | 2016-08-24 | 2015-04-26 12:37:19 | 2015-09-20 12:37:19 | |
52 | eos temporibus omnis | No | 2016-05-23 | 2015-03-13 12:37:19 | 2015-09-05 12:37:19 | |
53 | molestiae | No | 2016-06-04 | 2015-04-21 12:37:19 | 2015-07-10 12:37:19 | |
54 | minima in voluptatem | No | 2016-10-04 | 2015-05-29 12:37:19 | 2015-08-01 12:37:19 | |
55 | dolor | No | 2016-04-10 | 2015-06-11 12:37:19 | 2015-07-15 12:37:19 | |
56 | sit | No | 2016-09-10 | 2015-05-11 12:37:19 | 2015-09-14 12:37:19 | |
57 | neque | No | 2016-05-24 | 2015-03-19 12:37:19 | 2015-08-28 12:37:19 | |
58 | atque et | No | 2016-03-29 | 2015-05-28 12:37:19 | 2015-08-15 12:37:19 | |
59 | alias libero | No | 2016-01-09 | 2015-03-23 12:37:19 | 2015-06-22 12:37:19 | |
60 | voluptas repellendus | No | 2016-05-02 | 2015-06-02 12:37:19 | 2015-09-11 12:37:19 |