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 | |
---|---|---|---|---|---|---|
—
:
— : | ||||||
481-500 / 500 show all | ||||||
481 | et | No | 2016-10-23 | 2015-06-05 12:37:26 | 2015-08-25 12:37:26 | |
482 | consequuntur eum | No | 2016-06-05 | 2015-05-01 12:37:26 | 2015-08-16 12:37:26 | |
483 | laborum dicta | No | 2016-02-28 | 2015-05-09 12:37:26 | 2015-08-06 12:37:26 | |
484 | quia | No | 2016-05-31 | 2015-05-06 12:37:26 | 2015-07-26 12:37:26 | |
485 | ut tenetur | No | 2016-10-13 | 2015-06-10 12:37:26 | 2015-08-09 12:37:26 | |
486 | enim harum minima | No | 2016-09-25 | 2015-04-18 12:37:26 | 2015-07-18 12:37:26 | |
487 | natus et | No | 2016-01-31 | 2015-05-14 12:37:26 | 2015-09-08 12:37:26 | |
488 | doloribus veritatis | No | 2016-04-06 | 2015-06-17 12:37:26 | 2015-09-04 12:37:26 | |
489 | voluptatem | No | 2016-01-31 | 2015-06-02 12:37:27 | 2015-07-14 12:37:27 | |
490 | maxime | No | 2016-04-10 | 2015-05-21 12:37:27 | 2015-08-13 12:37:27 | |
491 | modi nesciunt | No | 2016-05-10 | 2015-05-04 12:37:27 | 2015-09-26 12:37:27 | |
492 | sed at | No | 2016-06-14 | 2015-05-13 12:37:27 | 2015-06-22 12:37:27 | |
493 | est | No | 2016-02-06 | 2015-05-28 12:37:27 | 2015-07-09 12:37:27 | |
494 | fugiat quaerat | No | 2016-06-10 | 2015-05-30 12:37:27 | 2015-08-10 12:37:27 | |
495 | qui ut in | No | 2016-10-08 | 2015-04-21 12:37:27 | 2015-07-27 12:37:27 | |
496 | velit non pariatur | Yes | 2016-09-06 | 2015-04-07 12:37:27 | 2015-07-28 12:37:27 | |
497 | impedit quo | No | 2016-07-09 | 2015-04-11 12:37:27 | 2015-09-11 12:37:27 | |
498 | sed | Yes | 2016-07-07 | 2015-04-05 12:37:27 | 2015-08-08 12:37:27 | |
499 | voluptatem | No | 2016-06-19 | 2015-05-09 12:37:27 | 2015-09-17 12:37:27 | |
500 | vel ea | Yes | 2016-03-30 | 2015-04-16 12:37:27 | 2015-07-11 12:37:27 |