Ext.namespace( 'instore.extlib.ui.grid' ); instore.extlib.ui.grid.MasterDetailGridPanel = function(config, detailField, masterTitle, DWRgetMasterMethod, DWReditMasterMethod, detailTitle, DWRgetDetailMethod, DWReditDetailMethod) { if(detailField) { this.detailField = detailField; this.masterTitle = masterTitle || " "; this.DWRgetMasterMethod = DWRgetMasterMethod || null; this.DWReditMasterMethod = DWReditMasterMethod || null; this.detailTitle = detailTitle || " "; this.DWRgetDetailMethod = DWRgetDetailMethod || null; this.DWReditDetailMethod = DWReditDetailMethod || null; instore.extlib.ui.grid.MasterDetailGridPanel.superclass.constructor.call(this, config); } else return; }; Ext.extend(instore.extlib.ui.grid.MasterDetailGridPanel, Ext.Panel, { layout:'border', load: function() { if(this.DWReditMasterMethod != null) this.masterGridPanel.load(null, this.masterTitle, this.DWRgetMasterMethod, this.DWReditMasterMethod); else this.masterGridPanel.load(null, this.masterTitle, this.DWRgetMasterMethod); }, initComponent: function() { var masterConfig = Ext.apply(this.initialConfig, {region: 'center'}); this.masterGridPanel = (this.DWReditMasterMethod != null) ? new instore.extlib.ui.grid.EditorGridPanel(masterConfig) : new instore.extlib.ui.grid.GridPanel(masterConfig); var detailConfig = Ext.apply(this.initialConfig, {region: 'south', split: true}); this.detailGridPanel = (this.DWReditDetailMethod != null) ? new instore.extlib.ui.grid.EditorGridPanel(detailConfig) : new instore.extlib.ui.grid.GridPanel(detailConfig); this.masterGridPanel.on("rowclick", function(grid, rowIdx, e) { var searchParams = {}; searchParams[this.detailField] = grid.getStore().getAt(rowIdx).id; if(this.DWReditDetailMethod != null) this.detailGridPanel.load({searchParams: searchParams}, this.detailTitle, this.DWRgetDetailMethod, this.DWReditDetailMethod); else this.detailGridPanel.load({searchParams: searchParams}, this.detailTitle, this.DWRgetDetailMethod); }, this); this.items = [this.masterGridPanel, this.detailGridPanel]; instore.extlib.ui.grid.MasterDetailGridPanel.superclass.initComponent.call(this); } });