Mercurial > lada > lada-client
comparison app/view/grid/Messmethoden.js @ 758:b2fcbdc4969d
Filled MessmethodenGrid with life.
author | Dustin Demuth <dustin@intevation.de> |
---|---|
date | Wed, 06 May 2015 16:24:23 +0200 |
parents | b8502964f5c3 |
children | b7484c7da2d4 |
comparison
equal
deleted
inserted
replaced
757:b8502964f5c3 | 758:b2fcbdc4969d |
---|---|
50 } | 50 } |
51 }); | 51 }); |
52 | 52 |
53 this.plugins = [this.rowEditing]; | 53 this.plugins = [this.rowEditing]; |
54 | 54 |
55 | |
56 | |
55 this.dockedItems = [{ | 57 this.dockedItems = [{ |
56 xtype: 'toolbar', | 58 xtype: 'toolbar', |
57 dock: 'bottom', | 59 dock: 'bottom', |
58 items: ['->', { | 60 items: ['->', { |
59 text: i18n.getMsg('add'), | 61 text: i18n.getMsg('add'), |
60 icon: 'resources/img/list-add.png', | 62 icon: 'resources/img/list-add.png', |
61 action: 'add', | 63 action: 'add', |
62 probeId: this.probeId, | 64 recordId: this.recordId, |
63 parentId: this.parentId | |
64 }, { | 65 }, { |
65 text: i18n.getMsg('delete'), | 66 text: i18n.getMsg('delete'), |
66 icon: 'resources/img/list-remove.png', | 67 icon: 'resources/img/list-remove.png', |
67 action: 'delete' | 68 action: 'delete' |
68 }] | 69 }] |
69 }]; | 70 }]; |
70 this.columns = [{ | 71 this.columns = [{ |
71 header: 'Messmethode', | 72 header: 'Messmethode', |
72 dataIndex: 'id', | 73 dataIndex: 'mmtId', |
73 flex: 1, | 74 flex: 1, |
74 renderer: function(value) { | 75 renderer: function(value) { |
75 if (!value || value === '') { | 76 if (!value || value === '') { |
76 return ''; | 77 return ''; |
77 } | 78 } |
78 var store = Ext.data.StoreManager.get('messmethode'); | 79 var store = Ext.data.StoreManager.get('messmethoden'); |
79 return store.findRecord('mprId', value, 0, false, false, true).get('messmethode'); | 80 if (!store) { |
81 store = Ext.create('Lada.store.Messmethoden'); | |
82 } | |
83 return value + " - " + store.findRecord('id', value, 0, false, false, true).get('messmethode'); | |
80 }, | 84 }, |
81 editor: { | 85 editor: { |
82 xtype: 'combobox', | 86 xtype: 'combobox', |
83 store: Ext.data.StoreManager.get('messmethode'), | 87 store: Ext.data.StoreManager.get('messmethoden'), |
84 displayField: 'messmethode', | 88 //displayField: 'mmtId', |
85 valueField: 'id', | 89 valueField: 'id', |
86 allowBlank: false, | 90 allowBlank: false, |
87 editable: true, | 91 editable: true, |
88 forceSelection: true, | 92 forceSelection: true, |
89 autoSelect: true, | 93 autoSelect: true, |
90 queryMode: 'local', | 94 queryMode: 'local', |
91 minChars: 0, | 95 minChars: 0, |
92 typeAhead: false, | 96 typeAhead: false, |
93 triggerAction: 'all' | 97 triggerAction: 'all', |
98 tpl: Ext.create("Ext.XTemplate", | |
99 '<tpl for="."><div class="x-combo-list-item x-boundlist-item" >' + | |
100 '{id} - {messmethode}</div></tpl>'), | |
101 displayTpl: Ext.create('Ext.XTemplate', | |
102 '<tpl for=".">{id} - {messmethode}</tpl>'), | |
94 } | 103 } |
95 }]; | 104 }]; |
96 this.initData(); | 105 this.initData(); |
97 this.callParent(arguments); | 106 this.callParent(arguments); |
98 }, | 107 }, |
99 | |
100 initData: function() { | 108 initData: function() { |
101 if (this.store) { | 109 if (this.store) { |
102 this.store.removeAll(); | 110 this.store.removeAll(); |
103 } | 111 } |
104 else { | 112 else { |
105 this.store = Ext.create('Lada.store.MmtMessprogramm'); | 113 this.store = Ext.create('Lada.store.MmtMessprogramm'); |
106 } | 114 } |
107 this.store.load({ | 115 this.store.load({ |
108 params: { | 116 params: { |
109 mprId: this.recordId | 117 messprogrammId: this.recordId |
110 } | 118 } |
111 }); | 119 }); |
112 }, | 120 }, |
113 | |
114 setReadOnly: function(b) { | 121 setReadOnly: function(b) { |
115 if (b == true){ | 122 if (b == true){ |
116 //Readonly | 123 //Readonly |
117 if (this.getPlugin('rowedit')){ | 124 if (this.getPlugin('rowedit')){ |
118 this.getPlugin('rowedit').disable(); | 125 this.getPlugin('rowedit').disable(); |