partkeepr

fork of partkeepr
git clone https://git.e1e0.net/partkeepr.git
Log | Files | Refs | Submodules | README | LICENSE

commit 1efb5aa8b59fa78d7f585d860b5cbba2a7083f5a
parent 05c7cf4bd84242eb271babef18603814898dadfa
Author: Felicitus <felicitus@felicitus.org>
Date:   Sun, 28 Aug 2011 16:58:46 +0200

Added display for contained parts within a storage location

Diffstat:
Mfrontend/js/Components/StorageLocation/StorageLocationEditor.js | 57+++++++++++++++++++++++++++++++++++++++++++++++++++------
1 file changed, 51 insertions(+), 6 deletions(-)

diff --git a/frontend/js/Components/StorageLocation/StorageLocationEditor.js b/frontend/js/Components/StorageLocation/StorageLocationEditor.js @@ -1,10 +1,55 @@ Ext.define('PartKeepr.StorageLocationEditor', { extend: 'PartKeepr.Editor', alias: 'widget.StorageLocationEditor', - items: [{ - xtype: 'textfield', - name: 'name', - fieldLabel: i18n("Storage Location") - }], - saveText: i18n("Save Storage Location") + saveText: i18n("Save Storage Location"), + + initComponent: function () { + var config = {}; + + Ext.Object.merge(config, { + autoLoad: false, + model: "PartKeepr.Part", + autoSync: false, // Do not change. If true, new (empty) records would be immediately commited to the database. + remoteFilter: true, + remoteSort: true, + pageSize: 15}); + + this.store = Ext.create('Ext.data.Store', config); + + this.gridPanel = Ext.create("Ext.grid.Panel", { + store: this.store, + columnLines: true, + columns: [ + { + header: i18n("Name"), + dataIndex: 'name', + flex: 1, + minWidth: 200, + renderer: Ext.util.Format.htmlEncode + } + ] + }); + + var container = Ext.create("Ext.form.FieldContainer", { + fieldLabel: i18n("Contained Parts"), + labelWidth: 150, + layout: 'fit', + height: 200, + items: this.gridPanel + }); + + this.items = [{ + xtype: 'textfield', + name: 'name', + fieldLabel: i18n("Storage Location") + }, container ]; + + this.on("startEdit", this.onStartEdit, this); + this.callParent(); + }, + onStartEdit: function () { + this.store.getProxy().extraParams.storageLocation = this.record.get("name"); + this.store.load(); + } + }); \ No newline at end of file