You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
# available options for orm are: :active_record, :mongoid
99
102
# config.orm = :active_record
100
103
end
@@ -204,7 +207,7 @@ end
204
207
205
208
*`:like`, `:start_with`, `:end_with` for string or full text search
206
209
*`:eq`, `:not_eq`, `:lt`, `:gt`, `:lteq`, `:gteq`, `:in` for numeric
207
-
*`:date_range` for date range (only for Rails > 4.2.x)
210
+
*`:date_range` for date range (only for Rails > 4.2.x, see [here](#daterange-search))
208
211
*`:null_value` for nil field
209
212
*`Proc` for whatever (see [here](https://github.com/ajahongir/ajax-datatables-rails-v-0-4-0-how-to/blob/master/app/datatables/city_datatable.rb) for real example)
210
213
@@ -601,6 +604,21 @@ def get_raw_records
601
604
end
602
605
```
603
606
607
+
### Default scope
608
+
609
+
See [DefaultScope is evil](https://rails-bestpractices.com/posts/2013/06/15/default_scope-is-evil/) and [#223](https://github.com/jbox-web/ajax-datatables-rails/issues/223) and [#233](https://github.com/jbox-web/ajax-datatables-rails/issues/233).
610
+
611
+
### DateRange search
612
+
613
+
This feature works with [yadcf](https://github.com/vedmack/yadcf).
614
+
615
+
To enable the date range search, for example `created_at` :
616
+
617
+
* add a 'created_at' `<th>` in your html
618
+
* declare your column in `view_columns` : `created_at: { source: 'Post.created_at', cond: :date_range, delimiter: '-yadcf_delim-' }`
619
+
* add it in `data` : `created_at: record.decorate.created_at`
620
+
* setup yadcf to make `created_at` search field a range
621
+
604
622
### Generator Syntax
605
623
606
624
Also, a class that inherits from `AjaxDatatablesRails::Base` is not tied to an
0 commit comments