Mercurial > lada > lada-client
changeset 374:832e3c8f9191
Implemented dynamic ProbelList model. The model will get initialized by the
fields configured in the sql configuration.
author | Torsten Irländer <torsten.irlaender@intevation.de> |
---|---|
date | Tue, 20 Aug 2013 16:50:47 +0200 (2013-08-20) |
parents | 9b663418b614 |
children | 1327dd6ec246 |
files | app/controller/Sql.js app/model/ProbeList.js app/store/ProbenList.js app/view/proben/List.js |
diffstat | 4 files changed, 34 insertions(+), 13 deletions(-) [+] |
line wrap: on
line diff
--- a/app/controller/Sql.js Fri Aug 16 16:49:46 2013 +0200 +++ b/app/controller/Sql.js Tue Aug 20 16:50:47 2013 +0200 @@ -8,6 +8,7 @@ extend: 'Ext.app.Controller', stores: [ 'Proben', // List of found Proben + 'ProbenList', // List of found Proben 'Queries' ], requires: [
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/app/model/ProbeList.js Tue Aug 20 16:50:47 2013 +0200 @@ -0,0 +1,20 @@ +/** + * A ProbeList. + * This class represents the result list of "Proben" in the search query + * */ +Ext.define('Lada.model.ProbeList', { + extend: 'Lada.model.Base', + fields: [ + {name: "readonly"} + ], + idProperty: "probeId", + proxy: { + type: 'rest', + appendId: true, //default + url: 'server/rest/proben', + reader: { + type: 'json', + root: 'data' + } + } +});
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/app/store/ProbenList.js Tue Aug 20 16:50:47 2013 +0200 @@ -0,0 +1,7 @@ +/** + * Store for Proben + */ +Ext.define('Lada.store.ProbenList', { + extend: 'Ext.data.Store', + model: 'Lada.model.ProbeList' +});
--- a/app/view/proben/List.js Fri Aug 16 16:49:46 2013 +0200 +++ b/app/view/proben/List.js Tue Aug 20 16:50:47 2013 +0200 @@ -4,7 +4,7 @@ Ext.define('Lada.view.proben.List' ,{ extend: 'Ext.grid.Panel', alias: 'widget.probenlist', - store: 'Proben', + store: 'ProbenList', viewConfig: { maxHeight: 350, emptyText: 'Keine Proben gefunden.', @@ -13,18 +13,6 @@ minHeight: 35, deferEmptyText: false }, - availableColumns: [ - {header: 'Datenbasis', dataIndex: 'datenbasisId', width: 70}, - {header: 'MPL', dataIndex: 'mplId', width: 50}, - {header: 'UWB', dataIndex: 'umwId', width: 50}, - {header: 'MMT', dataIndex: 'messmethode'}, - {header: 'HPNR', dataIndex: 'hauptprobenNr'}, - {header: 'NPNR', dataIndex: 'nebenprobenNr'}, - {header: 'E.Gemeinde', dataIndex: 'bezeichnung', flex: 1}, - {header: 'Ursprungsgemeinde', dataIndex: 'kreis', flex: 1}, - {header: 'ProbeID', dataIndex: 'probeId'}, - {header: 'MST', dataIndex: 'mstId', width: 50} - ], initComponent: function() { this.dockedItems = [ { @@ -55,10 +43,15 @@ */ setupColumns: function(cols) { var rcols = []; + var mfields = []; + rcols.push({header: 'RW', dataIndex: 'readonly', width: 30, renderer: render_readonly}); + mfields.push(new Ext.data.Field({name: 'readonly'})); for (var i = cols.length - 1; i >= 0; i--){ rcols.push(cols[i]); + mfields.push(new Ext.data.Field({name: cols[i].dataIndex})); } + this.store.model.setFields(mfields); this.reconfigure(this.store, rcols); } });