Class: ExtPricefield

Inherits:
ExtNode show all
Includes:
FormField
Defined in:
lib/extplugins/pricefield.rb

Overview

depend on extjs currenct pluginclass Ext < ExtNode

Constant Summary collapse

@@ALIAS_CONFIG =
{
  :text => :fieldLabel
}

Instance Attribute Summary

Attributes inherited from ExtNode

#childs, #config, #deep_lvl, #default_config, #parent, #xtype

Instance Method Summary collapse

Methods included from FormField

included

Methods inherited from ExtNode

#add_child, #apply_config, before_to_extjs, #build_abstract_function, #child_of?, #child_of_form?, #collect_events, #collect_ref, #conv_id_to_label, #conv_id_to_name, #conv_id_to_ref, #do_alias_config, #do_layout, #find, #find_field_elements, #find_parent, #get_all_siblings, get_before_filters, #get_deep, get_events, get_refs, #has_child?, #is_field_element?, #override_config, #prepare_config, #remove_childs, #remove_config, reset_generator_config, #root?, set_generator_config, #set_parent, #to_extjs

Constructor Details

#initialize(config, parent) ⇒ ExtPricefield

Returns a new instance of ExtPricefield.



10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
# File 'lib/extplugins/pricefield.rb', line 10

def initialize(config, parent)
  @default_config = {
    :labelAlign => "right",
    :cls => "number",
    # :plugins => [{ xclass: "Ext.plugin.Price" }, { ptype: "multiple_validations"}],
    :plugins => [{ xclass: "Ext.plugin.Price" } ],
    :priceConfig => {}
  }

  if config[:decimalPrecision]
    @default_config[:priceConfig].merge!({ :decimalPrecision => config[:decimalPrecision] })
    config.delete :decimalPrecision
  end

  if config[:currencySymbol]
    @default_config[:priceConfig].merge!({ :currencySymbol => config[:currencySymbol] })
    config.delete :currencySymbol
  end

  if config[:allowNegative]
    @default_config[:priceConfig].merge!({ :allowNegative => config[:allowNegative] })
    config.delete :allowNegative
  end

  super "textfield", config, parent 
end