comparison app/view/grid/Status.js @ 958:5d57c6c53e20

Made the grids more robust against erroneous data
author Dustin Demuth <dustin@intevation.de>
date Tue, 10 Nov 2015 09:50:06 +0100
parents 881984972e0e
children 6f1cc3316e2d
comparison
equal deleted inserted replaced
957:881984972e0e 958:5d57c6c53e20
45 } 45 }
46 }); 46 });
47 this.plugins = [this.rowEditing]; 47 this.plugins = [this.rowEditing];
48 48
49 var statusWerteStore = Ext.create('Lada.store.StatusWerte'); 49 var statusWerteStore = Ext.create('Lada.store.StatusWerte');
50 statusWerteStore.load(); 50 statusWerteStore.load(); //add params messungid
51 var statusStufeStore = Ext.create('Lada.store.StatusStufe'); 51 var statusStufeStore = Ext.create('Lada.store.StatusStufe');
52 statusStufeStore.load(); 52 statusStufeStore.load(); //add params messungid
53 this.dockedItems = [{ 53 this.dockedItems = [{
54 xtype: 'toolbar', 54 xtype: 'toolbar',
55 dock: 'bottom', 55 dock: 'bottom',
56 items: ['->', { 56 items: ['->', {
57 text: 'Hinzufügen', 57 text: 'Hinzufügen',
93 sortable: false, 93 sortable: false,
94 }, { 94 }, {
95 header: 'Stufe', 95 header: 'Stufe',
96 dataIndex: 'statusStufe', 96 dataIndex: 'statusStufe',
97 renderer: function(value) { 97 renderer: function(value) {
98 var r;
98 if (value===null || value === '') { 99 if (value===null || value === '') {
99 return 'Fehlerhafte Daten'; 100 r = 'Error';
100 } 101 }
101 var item = statusStufeStore.getById(value); 102 var item = statusStufeStore.getById(value);
102 var r;
103 if (item) { 103 if (item) {
104 r = item.get('stufe'); 104 r = item.get('stufe');
105 }
106 if (r === null) {
107 r = 'Error';
108 } 105 }
109 return r; 106 return r;
110 }, 107 },
111 editor: { 108 editor: {
112 xtype: 'combobox', 109 xtype: 'combobox',
119 sortable: false, 116 sortable: false,
120 }, { 117 }, {
121 header: 'Status', 118 header: 'Status',
122 dataIndex: 'statusWert', 119 dataIndex: 'statusWert',
123 renderer: function(value) { 120 renderer: function(value) {
121 var r;
124 if (value===null || value === '') { 122 if (value===null || value === '') {
125 return ''; 123 r = 'Error';
126 } 124 }
127 var item = statusWerteStore.getById(value); 125 var item = statusWerteStore.getById(value);
128 var r;
129 if (item) { 126 if (item) {
130 r = item.get('wert'); 127 r = item.get('wert');
131 }
132 if (r === null) {
133 r = 'Error';
134 } 128 }
135 return r; 129 return r;
136 }, 130 },
137 editor: { 131 editor: {
138 xtype: 'combobox', 132 xtype: 'combobox',

http://lada.wald.intevation.org