Method: Effective::Datatable#initialize

Defined in:
app/models/effective/datatable.rb

#initialize(view = nil, attributes = nil) ⇒ Datatable

Returns a new instance of Datatable.



36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
# File 'app/models/effective/datatable.rb', line 36

def initialize(view = nil, attributes = nil)
  (attributes = view; view = nil) if view.kind_of?(Hash)

  @attributes = (attributes || {})
  @state = initial_state

  @_aggregates = {}
  @_bulk_actions = []
  @_charts = {}
  @_columns = {}
  @_filters = {}
  @_form = {}
  @_scopes = {}

  raise 'expected a hash of arguments' unless @attributes.kind_of?(Hash)
  raise 'collection is defined as a method. Please use the collection do ... end syntax.' unless collection.nil?

  self.view = view if view
end