From 97c8f5db47b574a8e69fec1c03e822a244b76950 Mon Sep 17 00:00:00 2001
From: Renaud Le Gac <renaud.legac@free.fr>
Date: Tue, 14 Dec 2010 21:51:06 +0000
Subject: [PATCH] Modify to create either a grid with/without a gridfilter.

---
 .../plugin_dbui/lib/appviewportintreegrid.js  | 39 ++++++++++++++++++-
 1 file changed, 38 insertions(+), 1 deletion(-)

diff --git a/static/plugin_dbui/lib/appviewportintreegrid.js b/static/plugin_dbui/lib/appviewportintreegrid.js
index 08ffbf4c..0aa4e06b 100644
--- a/static/plugin_dbui/lib/appviewportintreegrid.js
+++ b/static/plugin_dbui/lib/appviewportintreegrid.js
@@ -50,8 +50,45 @@ App.viewport.InTreePanelGrid = Ext.extend(App.viewport.InTreePanelBase, {
 		cfgSvc.getGridModel(table, function(provider,response){
 		
 			var cfg = response.result;
-			var wdg = Ext.ComponentMgr.create(cfg);		
+			var wdg = Ext.ComponentMgr.create(cfg);
 			
+			if('filterModel' in cfg.model){
+				console.debug(table);
+				// instantiate the grid and the filter
+				var grid = wdg;
+				var gridfilter = Ext.ComponentMgr.create(cfg.model.filterModel);
+				gridfilter.bind(grid);
+				
+				// embedded the grid and the filter in a panel
+				var wdg = new Ext.Panel({
+					layout: 'border',
+					items: [{
+						region: 'center',
+						layout: 'fit',
+						items: [grid],
+					}, {
+						region: 'east',
+						layout: 'form',
+						collapsible: true,
+						collapsed: true,
+						defaults: {anchor: '100%'},
+						frame: true,
+						items: [gridfilter],
+						width: 300,
+						split: true,
+						buttons: [{text: 'reset', ref: '../../resetButton'}],
+					}],
+				});
+
+				// connect the reset button
+				wdg.resetButton.on('click', gridfilter.onReset, gridfilter);
+
+			} else {
+				
+				// create a stand alone grid
+				
+			}
+					
 			component.add(wdg);
 			component.doLayout();
 			
-- 
GitLab