comparison app/view/grid/Status.js @ 998:4bbb3da88c14

Statusreset: added a confirmation dialog and i18n
author Dustin Demuth <dustin@intevation.de>
date Mon, 11 Jan 2016 11:36:35 +0100
parents bf7bb9583a40
children 5beb2581a989
comparison
equal deleted inserted replaced
997:c943340176d4 998:4bbb3da88c14
12 Ext.define('Lada.view.grid.Status', { 12 Ext.define('Lada.view.grid.Status', {
13 extend: 'Ext.grid.Panel', 13 extend: 'Ext.grid.Panel',
14 alias: 'widget.statusgrid', 14 alias: 'widget.statusgrid',
15 15
16 maxHeight: 350, 16 maxHeight: 350,
17 emptyText: 'Keine Statusangaben gefunden.',
18 minHeight: 110, 17 minHeight: 110,
19 viewConfig: { 18 viewConfig: {
20 deferEmptyText: false 19 deferEmptyText: false
21 }, 20 },
22 21
23 recordId: null, 22 recordId: null,
24 readOnly: true, 23 readOnly: true,
25 allowDeselect: true, 24 allowDeselect: true,
26 25
27 initComponent: function() { 26 initComponent: function() {
27 var i18n = Lada.getApplication().bundle;
28 this.emptyText = i18n.getMsg('statusgrid.emptyText');
29
28 var statusWerteStore = Ext.create('Lada.store.StatusWerte'); 30 var statusWerteStore = Ext.create('Lada.store.StatusWerte');
29 statusWerteStore.load({ 31 statusWerteStore.load({
30 params: { 32 params: {
31 messungsId: this.recordId 33 messungsId: this.recordId
32 } 34 }
58 60
59 this.dockedItems = [{ 61 this.dockedItems = [{
60 xtype: 'toolbar', 62 xtype: 'toolbar',
61 dock: 'bottom', 63 dock: 'bottom',
62 items: ['->', { 64 items: ['->', {
63 text: 'Zurücksetzen', 65 text: i18n.getMsg('reset'),
64 icon: 'resources/img/edit-redo.png', 66 icon: 'resources/img/edit-redo.png',
65 action: 'reset', 67 action: 'reset',
66 probeId: this.probeId, 68 probeId: this.probeId,
67 parentId: this.parentId 69 parentId: this.parentId
68 }, { 70 }, {
69 text: 'Hinzufügen', 71 text: i18n.getMsg('add'),
70 icon: 'resources/img/list-add.png', 72 icon: 'resources/img/list-add.png',
71 action: 'add', 73 action: 'add',
72 probeId: this.probeId, 74 probeId: this.probeId,
73 parentId: this.parentId 75 parentId: this.parentId
74 }] 76 }]
75 }]; 77 }];
76 this.columns = [{ 78 this.columns = [{
77 header: 'erstellt', 79 header: i18n.getMsg('statusgrid.header.datum'),
78 dataIndex: 'datum', 80 dataIndex: 'datum',
79 xtype: 'datecolumn', 81 xtype: 'datecolumn',
80 format: 'd.m.Y H:i', 82 format: 'd.m.Y H:i',
81 width: 110, 83 width: 110,
82 sortable: false 84 sortable: false
83 }, { 85 }, {
84 header: 'Erzeuger', 86 header: i18n.getMsg('statusgrid.header.erzeuger'),
85 dataIndex: 'erzeuger', 87 dataIndex: 'erzeuger',
86 renderer: function(value) { 88 renderer: function(value) {
87 var r = ''; 89 var r = '';
88 if (!value || value === '') { 90 if (!value || value === '') {
89 r = 'Error'; 91 r = i18n.getMsg('error');
90 } 92 }
91 var mstore = Ext.data.StoreManager.get('messstellen'); 93 var mstore = Ext.data.StoreManager.get('messstellen');
92 var item = mstore.getById(value); 94 var item = mstore.getById(value);
93 if (item) { 95 if (item) {
94 r = item.get('messStelle'); 96 r = item.get('messStelle');
103 allowBlank: false, 105 allowBlank: false,
104 editable: false 106 editable: false
105 }, 107 },
106 sortable: false 108 sortable: false
107 }, { 109 }, {
108 header: 'Stufe', 110 header: i18n.getMsg('statusgrid.header.statusStufe'),
109 dataIndex: 'statusStufe', 111 dataIndex: 'statusStufe',
110 renderer: function(value) { 112 renderer: function(value) {
111 var sta = Ext.data.StoreManager.get('statusstufe'); 113 var sta = Ext.data.StoreManager.get('statusstufe');
112 var r; 114 var r;
113 if (value===null || value === '') { 115 if (value===null || value === '') {
114 r = 'Error'; 116 r = i18n.getMsg('error');
115 } 117 }
116 var item = sta.getById(value); 118 var item = sta.getById(value);
117 if (item) { 119 if (item) {
118 r = item.get('stufe'); 120 r = item.get('stufe');
119 } 121 }
120 return r; 122 return r;
121 }, 123 },
122 sortable: false 124 sortable: false
123 }, { 125 }, {
124 header: 'Status', 126 header: i18n.getMsg('statusgrid.header.statusWert'),
125 dataIndex: 'statusWert', 127 dataIndex: 'statusWert',
126 renderer: function(value) { 128 renderer: function(value) {
127 var sta = Ext.data.StoreManager.get('statuswerte'); 129 var sta = Ext.data.StoreManager.get('statuswerte');
128 //This store is NOT used in the editor... 130 //This store is NOT used in the editor...
129 var r; 131 var r;
130 if (value===null || value === '') { 132 if (value===null || value === '') {
131 r = 'Error'; 133 r = i18n.getMsg('error');
132 } 134 }
133 var item = sta.getById(value); 135 var item = sta.getById(value);
134 if (item) { 136 if (item) {
135 r = item.get('wert'); 137 r = item.get('wert');
136 } 138 }
145 allowBlank: false, 147 allowBlank: false,
146 editable: false 148 editable: false
147 }, 149 },
148 sortable: false 150 sortable: false
149 }, { 151 }, {
150 header: 'Text', 152 header: i18n.getMsg('statusgrid.header.text'),
151 dataIndex: 'text', 153 dataIndex: 'text',
152 flex: 1, 154 flex: 1,
153 editor: { 155 editor: {
154 allowBlank: true, 156 allowBlank: true,
155 maxLength: 1000, 157 maxLength: 1000,

http://lada.wald.intevation.org