Class: Netzke::TableEditor
Overview
A widget used for editing a DB table. It contains a grid and a form which may display different DB fields, configured by grid_columns and form_fields configuration options respectively
Constant Summary
BorderLayoutPanel::REGIONS
Class Method Summary
collapse
Instance Method Summary
collapse
#region_aggregatees, #resize_region
Class Method Details
.js_extend_properties ⇒ Object
8
9
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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
|
# File 'lib/netzke/table_editor.rb', line 8
def self.js_extend_properties
{
:init_component => <<-END_OF_JAVASCRIPT.l,
:get_form_widget => <<-END_OF_JAVASCRIPT.l,
function(){
return this.getRegionWidget(this.region);
}
END_OF_JAVASCRIPT
:on_row_click => <<-END_OF_JAVASCRIPT.l,
function(grid, index, e){
// don't react if the selection hasn't changed
if (index == this.lastSelectedRow) return false;
this.lastSelectedRow = index;
// get id of the record
var recordId = this.getCenterWidget().getStore().getAt(index).get('id');
// load the form with the record id
this.getRegionWidget(this.region).loadRecord(recordId);
}
END_OF_JAVASCRIPT
:on_form_actioncomplete => <<-END_OF_JAVASCRIPT.l
function(grid, index, e){
this.getRegionWidget('center').store.load()
}
END_OF_JAVASCRIPT
}
end
|
Instance Method Details
#default_config ⇒ Object
74
75
76
77
|
# File 'lib/netzke/table_editor.rb', line 74
def default_config
super.merge!({:ext_config => {:title => false}})
end
|
#initial_aggregatees ⇒ Object
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
|
# File 'lib/netzke/table_editor.rb', line 86
def initial_aggregatees
split_region = config[:split_region] || :east
split_size = config[:split_size] || 200
{
:center => {
:widget_class_name => "GridPanel",
:data_class_name => config[:data_class_name],
:ext_config => {
:title => config[:grid_title] || config[:data_class_name].pluralize
}
}.deep_merge(config[:grid_config] || {}),
split_region => {
:widget_class_name => "FormPanel",
:data_class_name => config[:data_class_name],
:region_config => {
:width => split_size,
:height => split_size,
:split => true,
:collapsible => true
},
:ext_config => {
:title => config[:form_title] || "#{config[:data_class_name]} details",
:listeners => {:actioncomplete => {
:fn => "function(f, a){this.ownerCt.ownerCt.onFormActioncomplete(f,a)}".l
}}
}
}.deep_merge(config[:form_config] || {})
}
end
|
#js_config ⇒ Object
79
80
81
82
83
84
|
# File 'lib/netzke/table_editor.rb', line 79
def js_config
super.merge({
:region => config[:split_region]
})
end
|