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
18 19 20 |
# File 'app/models/effective/effective_datatable/state.rb', line 18 def display_length state[:length] end |
#display_start ⇒ Object
22 23 24 |
# File 'app/models/effective/effective_datatable/state.rb', line 22 def display_start state[:start] end |
#filter ⇒ Object Also known as: filters
13 14 15 |
# File 'app/models/effective/effective_datatable/state.rb', line 13 def filter state[:filter] end |
#offset ⇒ Object
42 43 44 |
# File 'app/models/effective/effective_datatable/state.rb', line 42 def offset [(page - 1), 0].max * per_page end |
#order_direction ⇒ Object
26 27 28 |
# File 'app/models/effective/effective_datatable/state.rb', line 26 def order_direction state[:order_dir] end |
#order_index ⇒ Object
30 31 32 |
# File 'app/models/effective/effective_datatable/state.rb', line 30 def order_index state[:order_index] end |
#order_name ⇒ Object
34 35 36 |
# File 'app/models/effective/effective_datatable/state.rb', line 34 def order_name state[:order_name] end |
#page ⇒ Object
46 47 48 |
# File 'app/models/effective/effective_datatable/state.rb', line 46 def page state[:start].to_i / state[:length] + 1 end |
#per_page ⇒ Object Also known as: limit
50 51 52 |
# File 'app/models/effective/effective_datatable/state.rb', line 50 def per_page state[:length] end |
#scope ⇒ Object Also known as: current_scope, scopes
7 8 9 |
# File 'app/models/effective/effective_datatable/state.rb', line 7 def scope state[:scope] end |
#search ⇒ Object
38 39 40 |
# File 'app/models/effective/effective_datatable/state.rb', line 38 def search state[:search] end |