Mercurial > lada > lada-client
comparison app/view/grid/FilterResult.js @ 792:d572ee3271ac
some work on a context-sensitive toolbar
author | Dustin Demuth <dustin@intevation.de> |
---|---|
date | Wed, 13 May 2015 13:00:13 +0200 |
parents | 3637c453f67d |
children | 255568e97c96 |
comparison
equal
deleted
inserted
replaced
791:56f91254cd23 | 792:d572ee3271ac |
---|---|
33 }, | 33 }, |
34 '->', | 34 '->', |
35 { | 35 { |
36 text: 'Probe erstellen', | 36 text: 'Probe erstellen', |
37 icon: 'resources/img/list-add.png', | 37 icon: 'resources/img/list-add.png', |
38 action: 'addProbe' | 38 action: 'addProbe', |
39 disabled: false | |
39 }, { | 40 }, { |
40 text: 'Messprogramm erstellen', | 41 text: 'Messprogramm erstellen', |
41 icon: 'resources/img/list-add.png', | 42 icon: 'resources/img/list-add.png', |
42 action: 'addMessprogramm' | 43 action: 'addMessprogramm', |
44 disabled: false | |
43 }, | 45 }, |
44 '-', | 46 '-', |
45 { | 47 { |
46 text: 'Proben Importieren', | 48 text: 'Proben Importieren', |
47 icon: 'resources/img/svn-commit.png', | 49 icon: 'resources/img/svn-commit.png', |
48 action: 'import' | 50 action: 'import', |
51 disabled: false | |
49 }, { | 52 }, { |
50 text: 'Proben Exportieren', | 53 text: 'Proben Exportieren', |
51 icon: 'resources/img/svn-update.png', | 54 icon: 'resources/img/svn-update.png', |
52 action: 'export' | 55 action: 'export', |
56 disabled: true | |
53 } | 57 } |
54 ] | 58 ] |
55 }]; | 59 }]; |
56 this.columns = []; | 60 this.columns = []; |
57 this.callParent(arguments); | 61 this.callParent(arguments); |
71 dock: 'bottom', | 75 dock: 'bottom', |
72 store: store, | 76 store: store, |
73 displayInfo: true | 77 displayInfo: true |
74 }]); | 78 }]); |
75 | 79 |
76 //Reset the Text int the Toolbar. | 80 //Configure the Toolbar. |
81 this.setMode(store); | |
82 }, | |
83 | |
84 /** | |
85 * Enables or disables Toolbar-Buttons according to the selected mode | |
86 */ | |
87 setMode: function(store) { | |
77 var t = Ext.getCmp('tbtitle'); | 88 var t = Ext.getCmp('tbtitle'); |
78 if (store.model.modelName == 'Lada.model.MessprogrammList') { | 89 var i18n = Lada.getApplication().bundle; |
90 if (store.model.modelName == 'Lada.model.ProbeList'){ | |
91 t.setText(i18n.getMsg('probelist')); | |
92 this.down('button[action=addMessprogramm]').disable(); | |
93 this.down('button[action=addProbe]').enable(); | |
94 this.down('button[action=import]').enable(); | |
95 this.down('button[action=export]').enable(); | |
96 } | |
97 else if (store.model.modelName == 'Lada.model.MessprogrammList') { | |
79 t.setText(i18n.getMsg('probeplanning')); | 98 t.setText(i18n.getMsg('probeplanning')); |
80 } | 99 this.down('button[action=addMessprogramm]').enable(); |
81 else if (store.model.modelName == 'Lada.model.ProbeList') { | 100 this.down('button[action=addProbe]').disable(); |
82 t.setText(i18n.getMsg('probelist')); | 101 this.down('button[action=import]').disable(); |
102 this.down('button[action=export]').disable(); | |
83 } | 103 } |
84 else { | 104 else { |
85 t.setText(''); | 105 t.setText(''); |
86 console.log('The model '+store.model.modelName+ | 106 console.log('The model '+store.model.modelName+ |
87 'was not defined in the FilterResultGrid.' + | 107 'was not defined in the FilterResultGrid.' + |
88 ' Hence the title could not be set.'); | 108 ' Hence the title could not be set.'); |
89 } | 109 } |
90 }, | 110 }, |
111 | |
91 /** | 112 /** |
92 * Setup columns of the Grid dynamically based on a list of given cols. | 113 * Setup columns of the Grid dynamically based on a list of given cols. |
93 * The function is called from the {@link Lada.controller.Sql#selectSql | 114 * The function is called from the {@link Lada.controller.Sql#selectSql |
94 * select sql event} | 115 * select sql event} |
95 */ | 116 */ |