comparison app/view/grid/PKommentar.js @ 572:2c8aa09402a2

Added controller for PKommentarGrid and implemented update/add/delete.
author Raimund Renkert <raimund.renkert@intevation.de>
date Tue, 10 Mar 2015 14:31:07 +0100
parents d47ee7439f44
children 612f4f933083
comparison
equal deleted inserted replaced
571:1dedce48e3e1 572:2c8aa09402a2
12 Ext.define('Lada.view.grid.PKommentar', { 12 Ext.define('Lada.view.grid.PKommentar', {
13 extend: 'Ext.grid.Panel', 13 extend: 'Ext.grid.Panel',
14 alias: 'widget.pkommentargrid', 14 alias: 'widget.pkommentargrid',
15 15
16 requires: [ 16 requires: [
17 'Ext.toolbar.Toolbar' 17 'Ext.toolbar.Toolbar',
18 'Lada.store.PKommentare'
18 ], 19 ],
19 20
20 maxHeight: 350, 21 maxHeight: 350,
21 emptyText: 'Keine Kommentaregefunden.', 22 emptyText: 'Keine Kommentaregefunden.',
22 minHeight: 65, 23 minHeight: 110,
23 viewConfig: { 24 viewConfig: {
24 deferEmptyText: false 25 deferEmptyText: false
25 }, 26 },
26 27
27 recordId: null, 28 recordId: null,
28 29
29 initComponent: function() { 30 initComponent: function() {
30 var rowEditing = Ext.create('Ext.grid.plugin.RowEditing', { 31 this.rowEditing = Ext.create('Ext.grid.plugin.RowEditing', {
31 clicksToMoveEditor: 1, 32 clicksToMoveEditor: 1,
32 autoCancel: false 33 autoCancel: false
33 }); 34 });
34 this.plugins = [rowEditing]; 35 this.plugins = [this.rowEditing];
35 this.dockedItems = [{ 36 this.dockedItems = [{
36 xtype: 'toolbar', 37 xtype: 'toolbar',
37 dock: 'bottom', 38 dock: 'bottom',
38 items: ['->', { 39 items: ['->', {
39 text: 'Hinzufügen', 40 text: 'Hinzufügen',
47 }] 48 }]
48 }]; 49 }];
49 this.columns = [{ 50 this.columns = [{
50 header: 'Erzeuger', 51 header: 'Erzeuger',
51 dataIndex: 'erzeuger', 52 dataIndex: 'erzeuger',
53 width: 140,
54 renderer: function(value) {
55 if (!value || value === '') {
56 return '';
57 }
58 var store = Ext.data.StoreManager.get('messstellen');
59 var record = store.getById(value);
60 return record.get('messStelle');
61 },
52 editor: { 62 editor: {
63 xtype: 'combobox',
64 store: Ext.data.StoreManager.get('messstellen'),
65 displayField: 'messStelle',
66 valueField: 'id',
53 allowBlank: false 67 allowBlank: false
54 } 68 }
55 }, { 69 }, {
56 header: 'Datum', 70 header: 'Datum',
57 dataIndex: 'datum', 71 dataIndex: 'datum',
63 } 77 }
64 }, { 78 }, {
65 header: 'Text', 79 header: 'Text',
66 dataIndex: 'text', 80 dataIndex: 'text',
67 flex: 1, 81 flex: 1,
82 renderer: function(value) {
83 return '<div style="white-space: normal !important;">' +
84 value + '</div>';
85 },
68 editor: { 86 editor: {
87 xtype: 'textarea',
69 allowBlank: false 88 allowBlank: false
70 } 89 }
71 }]; 90 }];
91 this.initData();
72 this.callParent(arguments); 92 this.callParent(arguments);
93 },
94
95 initData: function() {
96 this.store = Ext.create('Lada.store.PKommentare');
97 this.store.load({
98 params: {
99 probeId: this.recordId
100 }
101 });
73 } 102 }
74 }); 103 });

http://lada.wald.intevation.org