GridPanel
Abstract GridPanel-based editor for a JSON array of homogenious objects. Inherit from it in order to override:
<tt>store_data</p> - passes the data to be saved (e.g. to the persistant storage) <tt>initial_data</p> - should return initial data (e.g. from the persistant storage)
For an example of an implementation, see Netzke::FieldsConfigurator.
Don’t show the config tool def config_tool_needed?
false
end
# File lib/netzke/json_array_editor.rb, line 47
47: def before_load
48: data_class.rebuild_table
49: super
50: end
# File lib/netzke/json_array_editor.rb, line 13
13: def data_class
14: NetzkePersistentArrayAutoModel
15: end
Default predifined columns (override if needed)
# File lib/netzke/json_array_editor.rb, line 29
29: def default_columns
30: [{
31: :name => :id,
32: :attr_type => :integer
33: },{
34: :name => :name,
35: :attr_type => :string
36: },{
37: :name => :position,
38: :attr_type => :integer
39: }]
40: end
Fields for NetzkePersistentArrayAutoModel (override it)
# File lib/netzke/json_array_editor.rb, line 18
18: def dynamic_fields
19: default_columns.collect do |c|
20: {
21: :name => c[:name],
22: :type => c[:attr_type] == :json ? :text : c[:attr_type], # store :json columns as :text
23: :default => c[:default_value]
24: }
25: end
26: end
Override this
# File lib/netzke/json_array_editor.rb, line 57
57: def initial_data
58: []
59: end
Disabled; run with --debug to generate this.
Generated with the Darkfish Rdoc Generator 1.1.6.