Module: Effective::EffectiveDatatable::State
- Included in:
- Datatable
- Defined in:
- app/models/effective/effective_datatable/state.rb
Instance Method Summary collapse
- #display_length ⇒ Object
- #display_start ⇒ Object
- #filter ⇒ Object (also: #filters)
- #offset ⇒ Object
- #order_direction ⇒ Object
- #order_index ⇒ Object
- #order_name ⇒ Object
- #page ⇒ Object
- #per_page ⇒ Object (also: #limit)
- #scope ⇒ Object (also: #current_scope, #scopes)
- #search ⇒ Object
Instance Method Details
#display_length ⇒ Object
16 17 18 |
# File 'app/models/effective/effective_datatable/state.rb', line 16 def display_length state[:length] end |
#display_start ⇒ Object
20 21 22 |
# File 'app/models/effective/effective_datatable/state.rb', line 20 def display_start state[:start] end |
#filter ⇒ Object Also known as: filters
11 12 13 |
# File 'app/models/effective/effective_datatable/state.rb', line 11 def filter state[:filter] end |
#offset ⇒ Object
40 41 42 |
# File 'app/models/effective/effective_datatable/state.rb', line 40 def offset [(page - 1), 0].max * per_page end |
#order_direction ⇒ Object
24 25 26 |
# File 'app/models/effective/effective_datatable/state.rb', line 24 def order_direction state[:order_dir] end |
#order_index ⇒ Object
28 29 30 |
# File 'app/models/effective/effective_datatable/state.rb', line 28 def order_index state[:order_index] end |
#order_name ⇒ Object
32 33 34 |
# File 'app/models/effective/effective_datatable/state.rb', line 32 def order_name state[:order_name] end |
#page ⇒ Object
44 45 46 |
# File 'app/models/effective/effective_datatable/state.rb', line 44 def page state[:start].to_i / state[:length] + 1 end |
#per_page ⇒ Object Also known as: limit
48 49 50 |
# File 'app/models/effective/effective_datatable/state.rb', line 48 def per_page state[:length] end |
#scope ⇒ Object Also known as: current_scope, scopes
5 6 7 |
# File 'app/models/effective/effective_datatable/state.rb', line 5 def scope state[:scope] end |
#search ⇒ Object
36 37 38 |
# File 'app/models/effective/effective_datatable/state.rb', line 36 def search state[:search] end |