diff --git a/static/plugin_dbui/lib/appbase.js b/static/plugin_dbui/lib/appbase.js
index 67a2c9328640c44913c2f0ed472122e59e5f4bd5..e437d75f94073d5bd0cee4cff75819c3ac81983a 100644
--- a/static/plugin_dbui/lib/appbase.js
+++ b/static/plugin_dbui/lib/appbase.js
@@ -6,7 +6,6 @@
  * $Id$
  * 
  */
-
 Ext.namespace('App');
 
 /**
diff --git a/static/plugin_dbui/lib/appform.js b/static/plugin_dbui/lib/appform.js
index a06538d608bf42b9134331ada74057a859ae1a66..975c9bbbec224e21fb9895c127cac92b99c96c91 100644
--- a/static/plugin_dbui/lib/appform.js
+++ b/static/plugin_dbui/lib/appform.js
@@ -51,11 +51,15 @@ App.form.FormPanel = Ext.extend(Ext.form.FormPanel, {
 	 */	
 	initComponent: function () {
 		
+		function resetForm() {
+			this.reset();
+		}
+		
 		// construct the underlying class. DON'T MOVE
 		App.form.FormPanel.superclass.initComponent.call(this);
 		
 		// reset the form
-		this.buttonClear.on('click', function () {this.reset(); }, this.getForm());
+		this.buttonClear.on('click', resetForm, this.getForm());
 	},
 
 	/**
diff --git a/static/plugin_dbui/lib/appform2.js b/static/plugin_dbui/lib/appform2.js
index 2b8af0011a7f3986e380d9d51c2af09a50629540..ce20b6b6784985fbc198e66fd6b1ed35abf2db32 100644
--- a/static/plugin_dbui/lib/appform2.js
+++ b/static/plugin_dbui/lib/appform2.js
@@ -73,7 +73,7 @@ App.form.EntryFormPanel = Ext.extend(App.form.FormPanel, {
 		// Add handler to display tool tip for each field
 		// Require the configuration parameter tipText.
 		fields = this.findByType('field');
-		for (i = 0; i < fields.length; i += 1){
+		for (i = 0; i < fields.length; i += 1) {
 			field = fields[i];
 			if (field.tipText) {
 				field.on('render', App.form.setToolTip);
@@ -86,6 +86,14 @@ App.form.EntryFormPanel = Ext.extend(App.form.FormPanel, {
 	 */		
 	onSubmit: function () {
 
+		function onFailure(form, action) {
+			if (action.response) {
+				if (action.response.status !== 200) {
+					Ext.MessageBox.alert('Error', action.response.responseText);
+				}
+			}			
+		}
+		
 		this.getForm().submit({
 			clientValidation: true,
 			url: this.url,
@@ -97,13 +105,7 @@ App.form.EntryFormPanel = Ext.extend(App.form.FormPanel, {
 			},
 			reset: true,
 			waitMsg: 'Saving Record...',			
-			failure: function (form, action) {
-				if (action.response) {
-					if (action.response.status !== 200) {
-						Ext.MessageBox.alert('Error', action.response.responseText);
-					}
-				}
-			}
+			failure: onFailure
 		});
 	}
 });
diff --git a/static/plugin_dbui/lib/appgrid.js b/static/plugin_dbui/lib/appgrid.js
index 335fe1240f14a5a315e75b5cfecb9ade3621bc83..f6744017a1e116e6df3c6cda918ab394696605f7 100644
--- a/static/plugin_dbui/lib/appgrid.js
+++ b/static/plugin_dbui/lib/appgrid.js
@@ -112,8 +112,7 @@ App.grid.Grid = Ext.extend(Ext.grid.GridPanel, {
 		// the number of rows per page and will reload the store accordingly.
 		if (isPagingPlugin) {
 			grid.store.load({params: {start: 0, limit: 1}});
-		}
-		else {
+		} else {
 			grid.store.load();
 		}
 		return true;
diff --git a/static/plugin_dbui/lib/appgridfilter.js b/static/plugin_dbui/lib/appgridfilter.js
index 608e557f965f0a7b9fe3ece3fcaac1d4c5a61e4a..595f6e747b1885fb639d497c18eb9cbd5bf8a724 100644
--- a/static/plugin_dbui/lib/appgridfilter.js
+++ b/static/plugin_dbui/lib/appgridfilter.js
@@ -42,8 +42,10 @@ App.grid.GridFilter = Ext.extend(Ext.form.FieldSet, {
 	 * NOTE: 
 	 * the enableKeyEvents is mandatory for Ext.form.TextField
 	 */
-	defaults: {anchor: '100%',
-			   enableKeyEvents: true},
+	defaults: {
+		anchor: '100%',
+		enableKeyEvents: true
+	},
 	
 	/**
 	 * private method requests by the component model of Ext JS
@@ -63,11 +65,10 @@ App.grid.GridFilter = Ext.extend(Ext.form.FieldSet, {
 			// catch a change of value for combobox
 			if (field.xtype === 'xcombobox') {
 				field.on('select', this.onChange, this);
-			}
-			
-			// catch the key pressed enter for other fields
-			// wait that user finish to type to run the handler
-			else {
+				
+			} else {
+				// catch the key pressed enter for other fields
+				// wait that user finish to type to run the handler
 				field.on('keyup', this.onChange, this, {buffer: 500});
 			}
 		}
@@ -138,17 +139,16 @@ App.grid.GridFilter = Ext.extend(Ext.form.FieldSet, {
 		
 		if (value === '') {
 			delete this.filterConditions[field.name];
-		}
-		else {
+		} else {
 			this.filterConditions[field.name] = where;
 		}
 					
 		// build the complete where clause
-		for (i = 0; i < this.initialFilterConditions.length; i += 1){
+		for (i = 0; i < this.initialFilterConditions.length; i += 1) {
 			conditions.push(this.initialFilterConditions[i]);
 		}
 		
-		for( k in this.filterConditions){
+		for (k in this.filterConditions) {
 			if (this.filterConditions.hasOwnProperty(k)) {
 				conditions.push(this.filterConditions[k]);
 			}
@@ -169,8 +169,7 @@ App.grid.GridFilter = Ext.extend(Ext.form.FieldSet, {
 		
 		if (this.pagingToolbar) {
 			this.pagingToolbar.doRefresh();
-		}
-		else {
+		} else {
 			this.store.load();
 		}		
 	}
diff --git a/static/plugin_dbui/lib/appgridpaging.js b/static/plugin_dbui/lib/appgridpaging.js
index 1891ec9cd526cbaf848e8c19ae282d4bfe30661a..68f4413e06171289817e2637140add396b3d4bea 100644
--- a/static/plugin_dbui/lib/appgridpaging.js
+++ b/static/plugin_dbui/lib/appgridpaging.js
@@ -33,8 +33,10 @@ App.grid.Paging = Ext.extend(Object, {
 				 {
 					xtype: 'slider',
 					plugins: new Ext.slider.Tip(),
-					listeners: {changecomplete: this.onChangePageSize,
-								scope: bbar},
+					listeners: {
+						changecomplete: this.onChangePageSize,
+						scope: bbar
+					},
 					minValue: 1,
 					width: 100
 				 }, 
diff --git a/static/plugin_dbui/lib/appgridroweditor.js b/static/plugin_dbui/lib/appgridroweditor.js
index 7415268d12645d2513a5f51e1a67e732622530d2..bb5ce11373b36cbb6a35380d1e728ab72e7a8eb3 100644
--- a/static/plugin_dbui/lib/appgridroweditor.js
+++ b/static/plugin_dbui/lib/appgridroweditor.js
@@ -64,6 +64,25 @@ App.grid.RowEditor = Ext.extend(Ext.Window, {
 
 		var cbrec,  combo, combos, i, item, values;
 		
+		function onUpdateStore(store, rec, op) {
+			if (op === Ext.data.Record.COMMIT && Ext.version >= '3.2.1') {
+
+				values = this.formPanel.getForm().getValues();
+				for (item in values) {
+					if (values.hasOwnProperty(item)) {
+						rec.data[item] = values[item];
+					}
+				}
+
+				combos = this.findByType('xcombobox');
+				for (i = 0; i < combos.length; i += 1) {
+					combo = combos[i];
+					cbrec = combo.findRecord(combo.valueField, combo.getValue());
+					rec.data[combo.displayField] = cbrec.get(combo.displayField);
+				}
+			}
+		}
+		
 		this.grid = grid;
 		this.formPanel = this.items.first();
 
@@ -87,25 +106,7 @@ App.grid.RowEditor = Ext.extend(Ext.Window, {
 		// HACK: In version 3.2.1 the data in the record are lost somewhere
 		// As a consequence, the values appearing in the grid after an
 		// update are empty. This fix correct this issue.
-		this.grid.store.on("update", function (store, rec, op) {
-			if (op === Ext.data.Record.COMMIT && Ext.version >= '3.2.1') {
-
-				values = this.formPanel.getForm().getValues();
-				for (item in values) {
-					if (values.hasOwnProperty(item)) {
-						rec.data[item] = values[item];
-					}
-				}
-
-				combos = this.findByType('xcombobox');
-				for (i = 0; i < combos.length; i += 1) {
-					combo = combos[i];
-					cbrec = combo.findRecord(combo.valueField, combo.getValue());
-					rec.data[combo.displayField] = cbrec.get(combo.displayField);
-				}
-				
-			}
-		}, this);	
+		this.grid.store.on("update", onUpdateStore, this);	
 	},
 
 	/**
@@ -276,7 +277,14 @@ App.grid.RowEditor = Ext.extend(Ext.Window, {
 	 */
 	onViewRow: function () {
 
-        var record = this.getSelected();
+		var record;
+		
+		function onHide() {
+			this.formPanel.buttonClear.show();
+			this.formPanel.buttonCreate.show();			
+		}
+		
+        record = this.getSelected();
 		if (!record) {return; }
 
 		this.setTitle("View the record...");
@@ -287,10 +295,7 @@ App.grid.RowEditor = Ext.extend(Ext.Window, {
 		this.formPanel.buttonClear.hide();
 		this.formPanel.buttonCreate.hide();
 
-		this.on("hide", function () {
-			this.formPanel.buttonClear.show();
-			this.formPanel.buttonCreate.show();
-		}, this);
+		this.on("hide", onHide, this);
 		
 	},
 	
diff --git a/static/plugin_dbui/lib/appviewportintreegrid.js b/static/plugin_dbui/lib/appviewportintreegrid.js
index 1214b82f08346b09f1e6b8f7672aa89d0f3d4cf4..2c545bbdb1ab2ea61d9dbf9b3b774fb8a5f6bfaa 100644
--- a/static/plugin_dbui/lib/appviewportintreegrid.js
+++ b/static/plugin_dbui/lib/appviewportintreegrid.js
@@ -40,17 +40,7 @@ App.viewport.InTreePanelGrid = Ext.extend(App.viewport.InTreePanelBase, {
 
 		var cfg, grid, gridfilter, table, wdg;
 		
-		// protection -- add widget when we are concern !				
-		if (this.getTopNodeNameFromId(component.id) !== this.topNodeName) {
-			return;
-		}
-		
-		// get the name of the table from the tab id
-		table = this.getNodeNameFromId(component.id);
-		
-		// Ask the server the widget configuration and create it
-		cfgSvc.getGridModel(table, function (provider, response) {
-		
+		function createGrid(provider, response) {
 			cfg = response.result;
 			wdg = Ext.ComponentMgr.create(cfg);
 			
@@ -84,17 +74,22 @@ App.viewport.InTreePanelGrid = Ext.extend(App.viewport.InTreePanelBase, {
 
 				// connect the reset button
 				wdg.resetButton.on('click', gridfilter.onReset, gridfilter);
-
-			} else {
-				
-				// create a stand alone grid
-				
 			}
 					
 			component.add(wdg);
 			component.doLayout();
-			
-		}, this);
+		}
+		
+		// protection -- add widget when we are concern !				
+		if (this.getTopNodeNameFromId(component.id) !== this.topNodeName) {
+			return;
+		}
+		
+		// get the name of the table from the tab id
+		table = this.getNodeNameFromId(component.id);
+		
+		// Ask the server the widget configuration and create it
+		cfgSvc.getGridModel(table, createGrid, this);
 	}
 });