netzke-basepack 0.6.0 → 0.6.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (93) hide show
  1. data/CHANGELOG.rdoc +14 -6
  2. data/README.rdoc +16 -31
  3. data/Rakefile +22 -16
  4. data/TODO.rdoc +1 -1
  5. data/app/models/netzke_field_list.rb +29 -29
  6. data/app/models/netzke_model_attr_list.rb +4 -4
  7. data/app/models/netzke_persistent_array_auto_model.rb +9 -9
  8. data/config/database.yml +2 -35
  9. data/features/accordion_panel.feature +1 -1
  10. data/features/form_panel.feature +2 -2
  11. data/features/grid_panel.feature +15 -3
  12. data/features/search_in_grid.feature +4 -4
  13. data/features/simple_panel.feature +4 -4
  14. data/features/step_definitions/pickle_steps.rb +2 -2
  15. data/features/step_definitions/web_steps.rb +5 -5
  16. data/features/support/env.rb +6 -6
  17. data/features/tab_panel.feature +1 -1
  18. data/javascripts/basepack.js +28 -28
  19. data/lib/netzke-basepack.rb +5 -5
  20. data/lib/netzke/active_record.rb +1 -1
  21. data/lib/netzke/active_record/association_attributes.rb +9 -9
  22. data/lib/netzke/active_record/attributes.rb +24 -23
  23. data/lib/netzke/active_record/combobox_options.rb +3 -3
  24. data/lib/netzke/active_record/relation_extensions.rb +4 -4
  25. data/lib/netzke/basepack.rb +4 -4
  26. data/{app/components → lib}/netzke/basepack/accordion_panel.rb +7 -7
  27. data/{app/components → lib}/netzke/basepack/basic_app.rb +18 -18
  28. data/{app/components → lib}/netzke/basepack/basic_app/statusbar_ext.js +0 -0
  29. data/lib/netzke/basepack/border_layout_panel.rb +101 -0
  30. data/{app/components → lib}/netzke/basepack/form_panel.rb +21 -21
  31. data/{app/components → lib}/netzke/basepack/form_panel/fields.rb +29 -36
  32. data/{app/components → lib}/netzke/basepack/form_panel/javascripts/netzkefileupload.js +0 -0
  33. data/{app/components → lib}/netzke/basepack/form_panel/javascripts/pre.js +9 -9
  34. data/{app/components → lib}/netzke/basepack/form_panel/javascripts/xcheckbox.js +1 -1
  35. data/{app/components → lib}/netzke/basepack/form_panel/services.rb +11 -11
  36. data/{app/components → lib}/netzke/basepack/grid_panel.rb +74 -92
  37. data/{app/components → lib}/netzke/basepack/grid_panel/columns.rb +34 -36
  38. data/{app/components → lib}/netzke/basepack/grid_panel/javascript.rb +7 -7
  39. data/{app/components → lib}/netzke/basepack/grid_panel/javascripts/advanced_search.js +10 -10
  40. data/{app/components → lib}/netzke/basepack/grid_panel/javascripts/edit_in_form.js +2 -2
  41. data/{app/components → lib}/netzke/basepack/grid_panel/javascripts/pre.js +31 -31
  42. data/{app/components → lib}/netzke/basepack/grid_panel/javascripts/rows-dd.js +1 -1
  43. data/{app/components → lib}/netzke/basepack/grid_panel/multi_edit_form.rb +2 -2
  44. data/{app/components → lib}/netzke/basepack/grid_panel/record_form_window.rb +3 -3
  45. data/{app/components → lib}/netzke/basepack/grid_panel/search_window.rb +11 -11
  46. data/{app/components → lib}/netzke/basepack/grid_panel/services.rb +28 -28
  47. data/{app/components → lib}/netzke/basepack/panel.rb +0 -0
  48. data/{app/components → lib}/netzke/basepack/search_panel.rb +11 -11
  49. data/{app/components → lib}/netzke/basepack/tab_panel.rb +7 -7
  50. data/lib/netzke/basepack/version.rb +1 -1
  51. data/{app/components → lib}/netzke/basepack/window.rb +14 -14
  52. data/{app/components → lib}/netzke/basepack/wrapper.rb +6 -6
  53. data/lib/netzke/data_accessor.rb +18 -18
  54. data/lib/netzke/fields_configurator.rb +30 -30
  55. data/lib/netzke/json_array_editor.rb +9 -9
  56. data/lib/netzke/masquerade_selector.rb +5 -5
  57. data/locale/en.yml +1 -1
  58. data/netzke-basepack.gemspec +252 -240
  59. data/spec/active_record/attributes_spec.rb +6 -1
  60. data/spec/active_record/relation_extensions_spec.rb +11 -11
  61. data/spec/components/form_panel_spec.rb +13 -19
  62. data/spec/components/grid_panel_spec.rb +1 -1
  63. data/test/rails_app/Gemfile +4 -3
  64. data/test/rails_app/Gemfile.lock +42 -50
  65. data/test/rails_app/app/components/book_grid.rb +4 -0
  66. data/test/rails_app/app/components/generic_user_form.rb +2 -2
  67. data/test/rails_app/app/components/simple_basic_app.rb +3 -3
  68. data/test/rails_app/app/components/simple_panel.rb +1 -1
  69. data/test/rails_app/app/components/some_border_layout.rb +12 -11
  70. data/test/rails_app/app/components/some_search_panel.rb +5 -5
  71. data/test/rails_app/app/components/user_form.rb +1 -1
  72. data/test/rails_app/app/components/window_component_loader.rb +2 -2
  73. data/test/rails_app/app/models/author.rb +7 -0
  74. data/test/rails_app/app/models/book.rb +3 -0
  75. data/test/rails_app/app/models/user.rb +1 -1
  76. data/test/rails_app/config/locales/es.yml +0 -1
  77. data/test/rails_app/config/routes.rb +2 -2
  78. data/test/rails_app/db/development_structure.sql +28 -3
  79. data/test/rails_app/db/migrate/20101026185816_create_authors.rb +14 -0
  80. data/test/rails_app/db/migrate/20101026190021_create_books.rb +17 -0
  81. data/test/rails_app/db/schema.rb +18 -1
  82. data/test/rails_app/public/javascripts/effects.js +1 -1
  83. data/test/rails_app/spec/models/author_spec.rb +5 -0
  84. data/test/rails_app/spec/models/book_spec.rb +5 -0
  85. data/test/test_helper.rb +1 -1
  86. data/test/unit/accordion_panel_test.rb +2 -2
  87. data/test/unit/active_record_basepack_test.rb +9 -9
  88. data/test/unit/fields_configuration_test.rb +4 -4
  89. data/test/unit/grid_panel_test.rb +8 -8
  90. data/test/unit/tab_panel_test.rb +2 -2
  91. metadata +49 -36
  92. data/.gitignore +0 -10
  93. data/app/components/netzke/basepack/border_layout_panel.rb +0 -39
@@ -31,7 +31,7 @@ module Netzke
31
31
  # Whether the column will be in the hidden state (hide/show columns from the column menu, if it's enabled).
32
32
  {:name => "hidden", :attr_type => :boolean},
33
33
 
34
- # Whether the column should have "grid filters" enabled
34
+ # Whether the column should have "grid filters" enabled
35
35
  # (see here: http://www.extjs.com/deploy/dev/examples/grid-filtering/grid-filter-local.html)
36
36
  {:name => "with_filters", :attr_type => :boolean, :default_value => true, :header => "Filters"},
37
37
 
@@ -49,9 +49,9 @@ module Netzke
49
49
  {:name => "sortable", :attr_type => :boolean, :default_value => true, :hidden => true},
50
50
  ]
51
51
  end
52
-
52
+
53
53
  end
54
-
54
+
55
55
  # Normalized columns for the grid, e.g.:
56
56
  # [{:name => :id, :hidden => true, ...}, {:name => :name, :editable => false, ...}, ...]
57
57
  def columns(only_included = true)
@@ -65,7 +65,7 @@ module Netzke
65
65
  end
66
66
  end
67
67
  end
68
-
68
+
69
69
  # Columns that we fall back to when neither persistent columns, nor configured columns are present.
70
70
  # If there's a model-level field configuration, it's being used.
71
71
  # Otherwise the defaults straight from the ActiveRecord model ("netzke_attributes").
@@ -73,18 +73,18 @@ module Netzke
73
73
  def default_columns
74
74
  @default_columns ||= load_model_level_attrs || data_class.netzke_attributes
75
75
  end
76
-
76
+
77
77
  # Columns that represent a smart merge of default_columns and columns passed during the configuration.
78
78
  def initial_columns(only_included = true)
79
79
  # Normalize here, as from the config we can get symbols (names) instead of hashes
80
80
  columns_from_config = config[:columns] && normalize_attrs(config[:columns])
81
-
82
-
81
+
82
+
83
83
  if columns_from_config
84
84
  # automatically add a column that reflects the primary key (unless specified in the config)
85
85
  columns_from_config.insert(0, {:name => data_class.primary_key}) unless columns_from_config.any?{ |c| c[:name] == data_class.primary_key }
86
-
87
- # reverse-merge each column hash from config with each column hash from exposed_attributes
86
+
87
+ # reverse-merge each column hash from config with each column hash from exposed_attributes
88
88
  # (columns from config have higher priority)
89
89
  for c in columns_from_config
90
90
  corresponding_default_column = default_columns.find{ |k| k[:name] == c[:name] }
@@ -95,9 +95,9 @@ module Netzke
95
95
  # we didn't have columns configured in component's config, so, use the columns from the data class
96
96
  columns_for_create = default_columns
97
97
  end
98
-
98
+
99
99
  filter_out_excluded_columns(columns_for_create) if only_included
100
-
100
+
101
101
  # Make the column config complete with the defaults
102
102
  columns_for_create.each do |c|
103
103
  detect_association(c)
@@ -112,65 +112,65 @@ module Netzke
112
112
 
113
113
  columns_for_create
114
114
  end
115
-
115
+
116
116
  private
117
117
  def filter_out_excluded_columns(cols)
118
118
  cols.reject!{ |c| c[:included] == false }
119
119
  end
120
-
120
+
121
121
  # Stores modified columns in persistent storage
122
122
  def save_columns!
123
123
  # NetzkeFieldList.update_list_for_current_authority(global_id, columns(false), original_data_class.name) if persistent_config_enabled?
124
124
  end
125
-
125
+
126
126
  def load_columns
127
127
  # NetzkeFieldList.read_list(global_id) if persistent_config_enabled?
128
128
  end
129
-
129
+
130
130
  def load_model_level_attrs
131
131
  # NetzkeModelAttrList.read_list(data_class.name) if persistent_config_enabled?
132
132
  end
133
-
133
+
134
134
  def set_default_header(c)
135
135
  c[:label] ||= c[:name].humanize
136
136
  end
137
-
137
+
138
138
  def set_default_editor(c)
139
139
  c[:editor] ||= editor_for_attr_type(c[:attr_type])
140
140
  c[:editor] = {:xtype => c[:editor]} if c[:editor].is_a?(Symbol)
141
141
  end
142
-
142
+
143
143
  def set_default_width(c)
144
144
  c[:width] ||= 50 if c[:attr_type] == :boolean
145
145
  c[:width] ||= 150 if c[:attr_type] == :datetime
146
146
  end
147
-
147
+
148
148
  def set_default_hidden(c)
149
149
  c[:hidden] = true if primary_key_attr?(c) && c[:hidden].nil?
150
150
  end
151
-
151
+
152
152
  def set_default_editable(c)
153
153
  c[:editable] = c[:read_only].nil? ? !(primary_key_attr?(c) || c[:virtual]) : !c[:read_only]
154
154
  c.delete(:read_only)
155
155
  end
156
-
156
+
157
157
  def set_default_sortable(c)
158
158
  c[:sortable] = !c[:virtual] if c[:sortable].nil?
159
159
  end
160
-
160
+
161
161
  def set_default_filterable(c)
162
162
  c[:filterable] = !c[:virtual] if c[:filterable].nil?
163
163
  end
164
-
164
+
165
165
  # Returns editor's xtype for a column type
166
166
  def editor_for_attr_type(type)
167
167
  attr_type_to_editor_map[type]
168
168
  end
169
-
169
+
170
170
  def editor_for_association
171
171
  :combobox
172
172
  end
173
-
173
+
174
174
  # Returns a hash that maps a column type to the editor xtype. Override if you want different editors.
175
175
  def attr_type_to_editor_map
176
176
  {
@@ -182,46 +182,44 @@ module Netzke
182
182
  :string => :textfield
183
183
  }
184
184
  end
185
-
185
+
186
186
  # Detects an association column and sets up the proper editor.
187
187
  def detect_association(c)
188
188
  # double-underscore notation? surely an association column
189
189
  if c[:name].index('__')
190
190
  assoc_name, assoc_method = c[:name].split('__')
191
- assoc = data_class.reflect_on_association(assoc_name.to_sym)
192
-
193
- if assoc && assoc_method
191
+ if assoc_method && assoc = data_class.reflect_on_association(assoc_name.to_sym)
194
192
  assoc_column = assoc.klass.columns_hash[assoc_method]
195
193
  assoc_method_type = assoc_column.try(:type)
196
-
194
+
197
195
  # if association column is boolean, display a checkbox (or alike), otherwise - a combobox (or alike)
198
196
  c[:editor] ||= assoc_method_type == :boolean ? editor_for_attr_type(:boolean) : editor_for_association
199
197
  end
200
198
  end
201
199
  end
202
-
200
+
203
201
  # Default fields that will be displayed in the Add/Edit/Search forms
204
202
  def default_fields_for_forms
205
203
  form_klass = "Netzke::ModelExtensions::#{config[:model]}ForFormPanel".constantize rescue nil
206
204
  form_klass ||= original_data_class
207
-
205
+
208
206
  # Select only those fields that are known to the form_klass
209
207
  selected_columns = columns.select do |c|
210
208
  form_klass.column_names.include?(c[:name]) ||
211
209
  form_klass.instance_methods.include?("#{c[:name]}=") ||
212
210
  association_attr?(c[:name])
213
211
  end
214
-
212
+
215
213
  selected_columns.map do |c|
216
214
  field_config = {:name => c[:name]}
217
-
215
+
218
216
  # scopes for combobox options
219
217
  field_config[:scopes] = c[:editor].is_a?(Hash) && c[:editor][:scopes]
220
-
218
+
221
219
  field_config
222
220
  end
223
221
  end
224
-
222
+
225
223
  # Receives 2 arrays of columns. Merges the missing config from the +source+ into +dest+, matching columns by name
226
224
  def reverse_merge_equally_named_columns(dest, source)
227
225
  dest.each{ |dc| dc.reverse_merge!(source.detect{ |sc| sc[:name] == dc[:name] } || {}) }
@@ -4,12 +4,12 @@ module Netzke
4
4
  # (Dynamic) JavaScript for GridPanel
5
5
  module Javascript
6
6
  extend ActiveSupport::Concern
7
-
7
+
8
8
  included do
9
9
  js_base_class "Netzke.pre.GridPanel"
10
10
  js_method :init_component, js_init_component
11
11
  end
12
-
12
+
13
13
  module InstanceMethods
14
14
  # The result of this method (a hash) is converted to a JSON object and passed as the configuration parameter
15
15
  # to the constructor of our JavaScript class. Override it when you want to pass any extra configuration
@@ -28,7 +28,7 @@ module Netzke
28
28
 
29
29
  module ClassMethods
30
30
  private
31
-
31
+
32
32
  # Ext.Component#initComponent, built up from pices (dependent on class-level configuration)
33
33
  def js_init_component
34
34
  # Optional "edit in form"-related events
@@ -48,7 +48,7 @@ module Netzke
48
48
  }, this);
49
49
  }
50
50
  END_OF_JAVASCRIPT
51
-
51
+
52
52
  # Result
53
53
  <<-END_OF_JAVASCRIPT
54
54
  function(){
@@ -56,13 +56,13 @@ module Netzke
56
56
  #{js_full_class_name}.superclass.initComponent.call(this);
57
57
  #{edit_in_form_events}
58
58
  }
59
-
59
+
60
60
  END_OF_JAVASCRIPT
61
61
  end
62
-
62
+
63
63
  # end private
64
64
  end
65
-
65
+
66
66
  end
67
67
  end
68
68
  end
@@ -1,18 +1,18 @@
1
1
  Ext.override(Netzke.pre.GridPanel, {
2
2
  onSearch: function(el){
3
3
  el.toggle(el.toggled); // do not toggle immediately
4
-
4
+
5
5
  this.loadComponent({name: 'search_form', callback: function(win){
6
6
  var currentConditionsString = this.getStore().baseParams.extra_conditions;
7
7
  if (currentConditionsString) {
8
8
  win.items.first().getForm().setValues(Ext.decode(currentConditionsString));
9
9
  }
10
-
10
+
11
11
  win.items.first().on('apply', function(){
12
12
  win.onSearch();
13
13
  return false; // do not propagate the 'apply' event
14
14
  }, this);
15
-
15
+
16
16
  win.on('close', function(){
17
17
  if (win.closeRes == 'OK'){
18
18
  var searchConditions = win.conditions;
@@ -30,7 +30,7 @@ Ext.override(Netzke.pre.GridPanel, {
30
30
  }
31
31
  }, this);
32
32
  }, scope: this});
33
-
33
+
34
34
  // delete this.searchWindow;
35
35
  // this.searchWindow = new Ext.Window({
36
36
  // title:'Advanced search',
@@ -52,15 +52,15 @@ Ext.override(Netzke.pre.GridPanel, {
52
52
  // }],
53
53
  // closePositively : function(){
54
54
  // this.conditions = this.getNetzkeComponent().getForm().getValues();
55
- // this.closeRes = 'OK';
55
+ // this.closeRes = 'OK';
56
56
  // this.close();
57
57
  // },
58
58
  // closeNegatively: function(){
59
- // this.closeRes = 'cancel';
59
+ // this.closeRes = 'cancel';
60
60
  // this.close();
61
61
  // }
62
62
  // });
63
- //
63
+ //
64
64
  // this.searchWindow.on('close', function(){
65
65
  // if (this.searchWindow.closeRes == 'OK'){
66
66
  // var searchConditions = this.searchWindow.conditions;
@@ -77,20 +77,20 @@ Ext.override(Netzke.pre.GridPanel, {
77
77
  // this.getStore().load();
78
78
  // }
79
79
  // }, this);
80
- //
80
+ //
81
81
  // this.searchWindow.on('add', function(container, searchPanel){
82
82
  // searchPanel.on('apply', function(component){
83
83
  // this.searchWindow.closePositively();
84
84
  // return false; // stop the event
85
85
  // }, this);
86
86
  // }, this);
87
- //
87
+ //
88
88
  // this.searchWindow.show(null, function(){
89
89
  // this.searchWindow.closeRes = 'cancel';
90
90
  // if (!this.searchWindow.getNetzkeComponent()){
91
91
  // this.loadComponent({id:"searchPanel", container:this.searchWindow.id});
92
92
  // }
93
93
  // }, this);
94
- //
94
+ //
95
95
  }
96
96
  });
@@ -15,7 +15,7 @@ Ext.override(Netzke.pre.GridPanel, {
15
15
  if (!form.baseParams) form.baseParams = {};
16
16
  form.baseParams.ids = Ext.encode(ids);
17
17
  }, this);
18
-
18
+
19
19
  w.on('close', function(){
20
20
  if (w.closeRes === "ok") {
21
21
  this.store.reload();
@@ -35,7 +35,7 @@ Ext.override(Netzke.pre.GridPanel, {
35
35
  }, scope: this});
36
36
  }
37
37
  },
38
-
38
+
39
39
  onAddInForm: function(){
40
40
  this.loadComponent({name: "add_form", callback: function(form){
41
41
  form.on('close', function(){
@@ -1,11 +1,11 @@
1
- /*
1
+ /*
2
2
  Static part of GridPanel's JavaScript class.
3
3
  */
4
4
  Netzke.pre.GridPanel = Ext.extend(Ext.grid.EditorGridPanel, {
5
5
  trackMouseOver: true,
6
6
  loadMask: true,
7
7
  autoScroll: true,
8
-
8
+
9
9
  initComponent: function(){
10
10
  this.plugins = []; // checkbox colums is a special case, being a plugin
11
11
 
@@ -31,7 +31,7 @@ Netzke.pre.GridPanel = Ext.extend(Ext.grid.EditorGridPanel, {
31
31
  } else {
32
32
  c.editor = {xtype: this.attrTypeEditorMap[c.attrType] || 'textfield'}
33
33
  }
34
-
34
+
35
35
  // if comboboxOptions are provided, we render a combobox instead of textfield
36
36
  if (c.comboboxOptions && c.editor.xtype === "textfield") {
37
37
  c.editor = {xtype: "combobox", options: c.comboboxOptions.split('\\n')}
@@ -80,7 +80,7 @@ Netzke.pre.GridPanel = Ext.extend(Ext.grid.EditorGridPanel, {
80
80
  // c.renderer = renderer
81
81
  // };
82
82
  // }
83
- //
83
+ //
84
84
  // add to the list
85
85
  // cmConfig.push(c);
86
86
  }
@@ -107,7 +107,7 @@ Netzke.pre.GridPanel = Ext.extend(Ext.grid.EditorGridPanel, {
107
107
  this.plugins.push(this.ddPlugin);
108
108
  }
109
109
 
110
- // Explicitely create the connection to get grid's data,
110
+ // Explicitely create the connection to get grid's data,
111
111
  // because we don't want the app-wide Ext.Ajax to be used,
112
112
  // as we are going to subscribe to its events
113
113
  var connection = new Ext.data.Connection({
@@ -168,10 +168,10 @@ Netzke.pre.GridPanel = Ext.extend(Ext.grid.EditorGridPanel, {
168
168
  // Now let Ext.grid.EditorGridPanel do the rest
169
169
  // Original initComponent
170
170
  Netzke.pre.GridPanel.superclass.initComponent.call(this);
171
-
171
+
172
172
  // Hidden change event
173
173
  if (this.persistentConfig) {this.getColumnModel().on('hiddenchange', this.onColumnHiddenChange, this);}
174
-
174
+
175
175
  // Inform the server part about column operations
176
176
  if (this.persistentConfig) {
177
177
  this.on('columnresize', this.onColumnResize, this);
@@ -243,12 +243,12 @@ Netzke.pre.GridPanel = Ext.extend(Ext.grid.EditorGridPanel, {
243
243
  // r.set('id', r.id); // otherwise later r.get('id') returns empty string
244
244
  this.stopEditing();
245
245
  this.getStore().add(r);
246
-
246
+
247
247
  // Set default values
248
248
  this.getStore().fields.each(function(field){
249
249
  r.set(field.name, field.defaultValue);
250
250
  });
251
-
251
+
252
252
  this.tryStartEditing(this.store.indexOf(r));
253
253
  },
254
254
 
@@ -283,7 +283,7 @@ Netzke.pre.GridPanel = Ext.extend(Ext.grid.EditorGridPanel, {
283
283
  } else {
284
284
  updatedRecords.push(Ext.apply(r.getChanges(), {id:r.id}));
285
285
  }
286
- },
286
+ },
287
287
  this);
288
288
 
289
289
  if (newRecords.length > 0 || updatedRecords.length > 0) {
@@ -292,22 +292,22 @@ Netzke.pre.GridPanel = Ext.extend(Ext.grid.EditorGridPanel, {
292
292
  if (newRecords.length > 0) {
293
293
  params.created_records = Ext.encode(newRecords);
294
294
  }
295
-
295
+
296
296
  if (updatedRecords.length > 0) {
297
297
  params.updated_records = Ext.encode(updatedRecords);
298
298
  }
299
-
299
+
300
300
  if (this.store.baseParams !== {}) {
301
301
  params.base_params = Ext.encode(this.store.baseParams);
302
302
  }
303
-
303
+
304
304
  this.postData(params);
305
305
  }
306
306
 
307
307
  },
308
308
 
309
309
  // Handlers for tools
310
- //
310
+ //
311
311
 
312
312
  onRefresh: function() {
313
313
  if (this.fireEvent('refresh', this) !== false) {
@@ -316,7 +316,7 @@ Netzke.pre.GridPanel = Ext.extend(Ext.grid.EditorGridPanel, {
316
316
  },
317
317
 
318
318
  // Event handlers
319
- //
319
+ //
320
320
 
321
321
  onColumnResize: function(index, size){
322
322
  this.resizeColumn({
@@ -348,15 +348,15 @@ Netzke.pre.GridPanel = Ext.extend(Ext.grid.EditorGridPanel, {
348
348
  onRowContextMenu: function(grid, rowIndex, e){
349
349
  e.stopEvent();
350
350
  var coords = e.getXY();
351
-
351
+
352
352
  if (!grid.getSelectionModel().isSelected(rowIndex)) {
353
353
  grid.getSelectionModel().selectRow(rowIndex);
354
354
  }
355
-
355
+
356
356
  var menu = new Ext.menu.Menu({
357
357
  items: this.contextMenu
358
358
  });
359
-
359
+
360
360
  menu.showAt(coords);
361
361
  },
362
362
 
@@ -369,7 +369,7 @@ Netzke.pre.GridPanel = Ext.extend(Ext.grid.EditorGridPanel, {
369
369
  },
370
370
 
371
371
  // Other methods
372
- //
372
+ //
373
373
 
374
374
  loadExceptionHandler: function(proxy, options, response, error){
375
375
  if (response.status == 200 && (responseObject = Ext.decode(response.responseText)) && responseObject.flash){
@@ -379,7 +379,7 @@ Netzke.pre.GridPanel = Ext.extend(Ext.grid.EditorGridPanel, {
379
379
  this.feedback(error.message);
380
380
  } else {
381
381
  this.feedback(response.statusText);
382
- }
382
+ }
383
383
  }
384
384
  },
385
385
 
@@ -403,7 +403,7 @@ Netzke.pre.GridPanel = Ext.extend(Ext.grid.EditorGridPanel, {
403
403
  }
404
404
  editableIndex++;
405
405
  });
406
-
406
+
407
407
  if (editableIndex < this.getColumnModel().config.length) {this.startEditing(row, editableIndex);}
408
408
  },
409
409
 
@@ -430,7 +430,7 @@ Netzke.pre.GridPanel = Ext.extend(Ext.grid.EditorGridPanel, {
430
430
  for (var k in records){
431
431
  records[k] = this.store.reader.readRecords([records[k]]).records[0];
432
432
  }
433
-
433
+
434
434
  // for each new record write the data returned by the server, and commit the record
435
435
  Ext.each(modRecordsInGrid, function(recordInGrid){
436
436
  if (mod ^ recordInGrid.isNew) {
@@ -438,7 +438,7 @@ Netzke.pre.GridPanel = Ext.extend(Ext.grid.EditorGridPanel, {
438
438
  var recordId = recordInGrid.id;
439
439
  // new data that the server sent us to update this record (identified by the id)
440
440
  var newData = records[recordId];
441
-
441
+
442
442
  if (newData){
443
443
  for (var k in newData.data){
444
444
  recordInGrid.set(k, newData.get(k));
@@ -447,10 +447,10 @@ Netzke.pre.GridPanel = Ext.extend(Ext.grid.EditorGridPanel, {
447
447
  recordInGrid.isNew = false;
448
448
  recordInGrid.commit();
449
449
  }
450
-
450
+
451
451
  }
452
452
  }, this);
453
-
453
+
454
454
  // clear the selections
455
455
  this.getSelectionModel().clearSelections();
456
456
 
@@ -459,7 +459,7 @@ Netzke.pre.GridPanel = Ext.extend(Ext.grid.EditorGridPanel, {
459
459
  if (modRecords.length == 0) {
460
460
  // if all records are accepted, reload the grid (so that eventual order/filtering is correct)
461
461
  this.store.reload();
462
-
462
+
463
463
  // ... and set default getRowClass function
464
464
  this.getView().getRowClass = this.defaultGetRowClass;
465
465
  } else {
@@ -467,7 +467,7 @@ Netzke.pre.GridPanel = Ext.extend(Ext.grid.EditorGridPanel, {
467
467
  return r.dirty ? "grid-dirty-record" : ""
468
468
  }
469
469
  }
470
-
470
+
471
471
  this.getView().refresh();
472
472
  this.getSelectionModel().fireEvent('selectionchange', this.getSelectionModel());
473
473
  },
@@ -481,7 +481,7 @@ Netzke.pre.GridPanel = Ext.extend(Ext.grid.EditorGridPanel, {
481
481
  this.getSelectionModel().selectRow(0);
482
482
  this.getSelectionModel().resumeEvents();
483
483
  },
484
-
484
+
485
485
  // Normalizes the renderer for a column.
486
486
  // Renderer may be:
487
487
  // 1) a string that contains the name of the function to be used as renderer.
@@ -508,7 +508,7 @@ Netzke.pre.GridPanel = Ext.extend(Ext.grid.EditorGridPanel, {
508
508
  name = c.renderer[0];
509
509
  args = c.renderer.slice(1);
510
510
  }
511
-
511
+
512
512
  // First check whether Ext.util.Format has it
513
513
  if (Ext.isFunction(Ext.util.Format[name])) {
514
514
  c.renderer = Ext.util.Format[name].createDelegate(this, args, 1);
@@ -528,7 +528,7 @@ Netzke.pre.GridPanel = Ext.extend(Ext.grid.EditorGridPanel, {
528
528
  this.tryStartEditing(this.store.indexOf(row));
529
529
  }
530
530
  }
531
-
531
+
532
532
  // :reorder_columns => <<-END_OF_JAVASCRIPT.l,
533
533
  // function(columns){
534
534
  // columnsInNewShipment = [];
@@ -539,5 +539,5 @@ Netzke.pre.GridPanel = Ext.extend(Ext.grid.EditorGridPanel, {
539
539
  // this.store.reader.recordType = newRecordType; // yes, recordType is a protected property, but that's the only way we can do it, and it seems to work for now
540
540
  // }
541
541
  // END_OF_JAVASCRIPT
542
-
542
+
543
543
  });