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



18
19
20
# File 'app/models/effective/effective_datatable/state.rb', line 18

def display_length
  state[:length]
end

#display_startObject



22
23
24
# File 'app/models/effective/effective_datatable/state.rb', line 22

def display_start
  state[:start]
end

#filterObject Also known as: filters



13
14
15
# File 'app/models/effective/effective_datatable/state.rb', line 13

def filter
  state[:filter]
end

#offsetObject



42
43
44
# File 'app/models/effective/effective_datatable/state.rb', line 42

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

#order_directionObject



26
27
28
# File 'app/models/effective/effective_datatable/state.rb', line 26

def order_direction
  state[:order_dir]
end

#order_indexObject



30
31
32
# File 'app/models/effective/effective_datatable/state.rb', line 30

def order_index
  state[:order_index]
end

#order_nameObject



34
35
36
# File 'app/models/effective/effective_datatable/state.rb', line 34

def order_name
  state[:order_name]
end

#pageObject



46
47
48
# File 'app/models/effective/effective_datatable/state.rb', line 46

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

#per_pageObject Also known as: limit



50
51
52
# File 'app/models/effective/effective_datatable/state.rb', line 50

def per_page
  state[:length]
end

#scopeObject Also known as: current_scope, scopes



7
8
9
# File 'app/models/effective/effective_datatable/state.rb', line 7

def scope
  state[:scope]
end

#searchObject



38
39
40
# File 'app/models/effective/effective_datatable/state.rb', line 38

def search
  state[:search]
end