Module: Effective::EffectiveDatatable::State

Included in:
Datatable
Defined in:
app/models/effective/effective_datatable/state.rb

Instance Method Summary collapse

Instance Method Details

#display_lengthObject



16
17
18
# File 'app/models/effective/effective_datatable/state.rb', line 16

def display_length
  state[:length]
end

#display_startObject



20
21
22
# File 'app/models/effective/effective_datatable/state.rb', line 20

def display_start
  state[:start]
end

#filterObject Also known as: filters



11
12
13
# File 'app/models/effective/effective_datatable/state.rb', line 11

def filter
  state[:filter]
end

#offsetObject



40
41
42
# File 'app/models/effective/effective_datatable/state.rb', line 40

def offset
  [(page - 1), 0].max * per_page
end

#order_directionObject



24
25
26
# File 'app/models/effective/effective_datatable/state.rb', line 24

def order_direction
  state[:order_dir]
end

#order_indexObject



28
29
30
# File 'app/models/effective/effective_datatable/state.rb', line 28

def order_index
  state[:order_index]
end

#order_nameObject



32
33
34
# File 'app/models/effective/effective_datatable/state.rb', line 32

def order_name
  state[:order_name]
end

#pageObject



44
45
46
# File 'app/models/effective/effective_datatable/state.rb', line 44

def page
  state[:start].to_i / state[:length] + 1
end

#per_pageObject Also known as: limit



48
49
50
# File 'app/models/effective/effective_datatable/state.rb', line 48

def per_page
  state[:length]
end

#scopeObject Also known as: current_scope, scopes



5
6
7
# File 'app/models/effective/effective_datatable/state.rb', line 5

def scope
  state[:scope]
end

#searchObject



36
37
38
# File 'app/models/effective/effective_datatable/state.rb', line 36

def search
  state[:search]
end