Class: Ext::Grid::Column::Base

Inherits:
Object
  • Object
show all
Defined in:
lib/ext/grid/column.rb

Instance Method Summary collapse

Constructor Details

#initialize(*args) ⇒ Base

Returns a new instance of Base.



12
13
14
# File 'lib/ext/grid/column.rb', line 12

def initialize(*args)
  @options = args.optionize :data_index, :header, :width, :renderer, :editor
end

Instance Method Details

#idObject



16
17
# File 'lib/ext/grid/column.rb', line 16

def id
end

#real_editor(e) ⇒ Object



37
38
39
40
41
42
43
# File 'lib/ext/grid/column.rb', line 37

def real_editor(e)
  case e
  when NilClass              then nil
  when Ext::Grid::GridEditor then e
  else Ext::Grid::GridEditor.new(e)
  end
end

#to_config(disabled = ni) ⇒ Object



19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
# File 'lib/ext/grid/column.rb', line 19

def to_config(disabled = ni)
  hash = {}
  keys = %w( id data_index header width renderer editor )
  disabled ||= []

  keys.each do |name|
    camel = name.camelize(:lower).intern
    value = @options[name]
    value = __send__(name) if value.nil?

    if !value.nil? and !disabled.include?(camel)
      hash[camel] = value
    end
  end
  hash[:editor] = real_editor(hash[:editor]) if hash[:editor]
  hash
end