# HG changeset patch # User Raimund Renkert # Date 1463497927 -7200 # Node ID a73726bba79c40408c4d1d729b4612b76a50efb3 # Parent 4a55e665f2d15f82641aa12b4d50b020c9e203ac Use custom row expander in probe list grid to display messung grid. diff -r 4a55e665f2d1 -r a73726bba79c app.js --- a/app.js Tue May 17 17:10:39 2016 +0200 +++ b/app.js Tue May 17 17:12:07 2016 +0200 @@ -29,6 +29,8 @@ 'Lada.override.RowEditor', 'Lada.override.i18n.DE', 'Lada.override.JSON', + 'Lada.override.RowExpander', + 'Lada.view.plugin.GridRowExpander', 'Ext.i18n.Bundle', 'Ext.layout.container.Column', 'Lada.store.Deskriptoren', diff -r 4a55e665f2d1 -r a73726bba79c app/controller/Filter.js --- a/app/controller/Filter.js Tue May 17 17:10:39 2016 +0200 +++ b/app/controller/Filter.js Tue May 17 17:12:07 2016 +0200 @@ -126,7 +126,15 @@ switch (queryType) { case 'probe': gridstore = Ext.create('Lada.store.ProbenList'); - frgrid = Ext.create('Lada.view.grid.ProbeList'); + frgrid = Ext.create('Lada.view.grid.ProbeList', { + plugins: [{ + ptype: 'gridrowexpander', + gridType: 'Lada.view.grid.Messung', + gridConfig: { + bottomBar: false + } + }] + }); break; case 'messung': gridstore = Ext.create('Lada.store.MessungenList'); diff -r 4a55e665f2d1 -r a73726bba79c app/controller/grid/Messung.js --- a/app/controller/grid/Messung.js Tue May 17 17:10:39 2016 +0200 +++ b/app/controller/grid/Messung.js Tue May 17 17:12:07 2016 +0200 @@ -39,30 +39,68 @@ * Window. */ editItem: function(grid, record) { - var probe = grid.up('window').record; - /* Only open a new Window when: - statusEdit = True - -or- - the value of status is not 0 - -or- - the owner = True + // we have a window with a probe record! + if (grid.up('window')) { + var probe = grid.up('window').record; + /* Only open a new Window when: + statusEdit = True + -or- + the value of status is not 0 + -or- + the owner = True - the statusWert attribute is not present in the original data. - it is appended, when the value and name of the status were - determined. - */ - if (record.get('statusEdit') - || record.get('statusWert') > 0 - || record.get('owner')) { - var win = Ext.create('Lada.view.window.MessungEdit', { - parentWindow: grid.up('window'), - probe: probe, - record: record, - grid: grid - }); - win.show(); - win.initData(); + the statusWert attribute is not present in the original data. + it is appended, when the value and name of the status were + determined. + */ + if (record.get('statusEdit') + || record.get('statusWert') > 0 + || record.get('owner')) { + var win = Ext.create('Lada.view.window.MessungEdit', { + parentWindow: grid.up('window'), + probe: probe, + record: record, + grid: grid + }); + win.show(); + win.initData(); + } + return; } + var probeRecord = Ext.create('Lada.model.ProbeList'); + probeRecord.setId(record.get('probeId')); + probeRecord.set('owner', record.get('owner')); + probeRecord.set('readonly', record.get('readonly')); + + var probeWin = Ext.create('Lada.view.window.ProbeEdit', { + record: probeRecord, + style: 'z-index: -1;' //Fixes an Issue where windows could not be created in IE8 + }); + + probeWin.setPosition(30); + probeWin.show(); + probeWin.initData(); + + Ext.ClassManager.get('Lada.model.Probe').load(record.get('probeId'), { + failure: function(record, action) { + me.setLoading(false); + // TODO + console.log('An unhandled Failure occured. See following Response and Record'); + console.log(action); + console.log(record); + }, + success: function(precord, response) { + var messungWin = Ext.create('Lada.view.window.MessungEdit', { + parentWindow: grid.up('window'), + probe: precord, + record: record, + grid: grid + }); + messungWin.show(); + messungWin.setPosition(window.innerWidth - 30 - messungWin.width); + messungWin.initData(); + } + }); }, /** diff -r 4a55e665f2d1 -r a73726bba79c app/controller/grid/ProbeList.js --- a/app/controller/grid/ProbeList.js Tue May 17 17:10:39 2016 +0200 +++ b/app/controller/grid/ProbeList.js Tue May 17 17:12:07 2016 +0200 @@ -37,6 +37,10 @@ }, 'probelistgrid toolbar button[action=print]': { click: this.printSelection + }, + 'probelistgrid gridview': { + expandbody: this.expandBody, + collapsebody: this.collapseBody } }); this.callParent(arguments); @@ -338,5 +342,21 @@ if (btn === 'yes') { location.reload(); } + }, + + expandBody: function(rowNode, record, expandRow) { +// var row = Ext.get('probe-row-' + record.get('id')); +// var messungGrid = Ext.create('Lada.view.grid.Messung', { +// recordId: record.get('id'), +// bottomBar: false, +// rowLines: true +// }); +// row.swallowEvent(['click', 'mousedown', 'mouseup', 'dblclick'], true); +// messungGrid.render(row); + }, + + collapseBody: function(rowNode, record, expandRow) { +// var element = Ext.get('probe-row-' + record.get('id')).down('div'); +// element.destroy(); } }); diff -r 4a55e665f2d1 -r a73726bba79c app/model/ProbeList.js --- a/app/model/ProbeList.js Tue May 17 17:10:39 2016 +0200 +++ b/app/model/ProbeList.js Tue May 17 17:12:07 2016 +0200 @@ -14,6 +14,9 @@ extend: 'Ext.data.Model', fields: [{ + name: 'pid', + mapping: 'id' + }, { name: 'readonly' }, { name: 'owner' diff -r 4a55e665f2d1 -r a73726bba79c app/view/grid/Messung.js --- a/app/view/grid/Messung.js Tue May 17 17:10:39 2016 +0200 +++ b/app/view/grid/Messung.js Tue May 17 17:12:07 2016 +0200 @@ -26,6 +26,7 @@ warnings: null, errors: null, readOnly: true, + bottomBar: true, allowDeselect: true, initComponent: function() { @@ -159,6 +160,9 @@ }; this.initData(); this.callParent(arguments); + if (!this.bottomBar) { + this.down('toolbar[dock=bottom]').hide(); + } this.setReadOnly(true); //Grid is always initialised as RO }, diff -r 4a55e665f2d1 -r a73726bba79c app/view/widget/DynamicGrid.js --- a/app/view/widget/DynamicGrid.js Tue May 17 17:10:39 2016 +0200 +++ b/app/view/widget/DynamicGrid.js Tue May 17 17:12:07 2016 +0200 @@ -83,6 +83,9 @@ fields.push(new Ext.data.Field({ name: 'statusEdit' })); + fields.push(new Ext.data.Field({ + name: 'id' + })); resultColumns.push({ xtype: 'actioncolumn', diff -r 4a55e665f2d1 -r a73726bba79c resources/css/lada.css --- a/resources/css/lada.css Tue May 17 17:10:39 2016 +0200 +++ b/resources/css/lada.css Tue May 17 17:12:07 2016 +0200 @@ -73,3 +73,15 @@ ::-ms-reveal { display: none; } + +.row-expander-grid .x-grid-row-selected .x-grid-td { + background-color : #c6c6c6; +} + +.row-expander-grid .x-grid-row-over .x-grid-td { + background-color : #e0e0e0; +} + +.row-expander-grid .x-grid-with-row-lines .x-grid-td { + border-bottom: 1px solid #e0e0e0; +}