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
<%= 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 | Title | Archived | Due Date | Added | Updated | |
---|---|---|---|---|---|---|
—
:
— : | ||||||
401-420 / 500 Sýna allt | ||||||
401 | cum deserunt nesciunt | Yes | 2016-03-04 | 2015-05-18 12:37:25 | 2015-07-03 12:37:25 | |
402 | at | No | 2016-04-29 | 2015-06-01 12:37:25 | 2015-08-16 12:37:25 | |
403 | et praesentium tempore | No | 2016-10-20 | 2015-05-01 12:37:25 | 2015-07-29 12:37:25 | |
404 | at aliquam corrupti | No | 2016-01-27 | 2015-05-23 12:37:25 | 2015-07-10 12:37:25 | |
405 | magni excepturi | No | 2016-10-19 | 2015-05-31 12:37:25 | 2015-09-17 12:37:25 | |
406 | sequi beatae | No | 2016-01-21 | 2015-04-26 12:37:25 | 2015-08-08 12:37:25 | |
407 | similique voluptatum | No | 2016-10-05 | 2015-05-08 12:37:25 | 2015-08-06 12:37:25 | |
408 | quibusdam voluptate | No | 2016-04-16 | 2015-04-10 12:37:25 | 2015-07-09 12:37:25 | |
409 | dolore et | No | 2016-05-02 | 2015-03-12 12:37:25 | 2015-08-02 12:37:25 | |
410 | et qui sint | No | 2016-05-14 | 2015-04-11 12:37:25 | 2015-09-07 12:37:25 | |
411 | iure | No | 2016-02-23 | 2015-03-21 12:37:25 | 2015-07-19 12:37:25 | |
412 | non | No | 2016-03-21 | 2015-03-17 12:37:25 | 2015-06-22 12:37:25 | |
413 | voluptate | No | 2016-03-10 | 2015-03-25 12:37:25 | 2015-09-25 12:37:25 | |
414 | quo architecto non | Yes | 2016-01-07 | 2015-05-19 12:37:25 | 2015-07-17 12:37:25 | |
415 | voluptatem | No | 2016-06-16 | 2015-04-17 12:37:25 | 2015-07-29 12:37:25 | |
416 | ipsam | Yes | 2016-07-14 | 2015-04-28 12:37:25 | 2015-08-22 12:37:25 | |
417 | provident eum | No | 2016-01-14 | 2015-05-26 12:37:25 | 2015-09-01 12:37:25 | |
418 | cupiditate ut illum | No | 2016-10-24 | 2015-05-27 12:37:25 | 2015-08-02 12:37:25 | |
419 | voluptatem rerum | Yes | 2016-01-24 | 2015-04-21 12:37:25 | 2015-07-20 12:37:25 | |
420 | rem neque | No | 2016-06-14 | 2015-04-14 12:37:25 | 2015-08-09 12:37:25 |