FFTCmpt.js
1.71 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
Ext.define('amdaPlotComp.plotFunction.FFTCmpt', {
extend: 'amdaPlotComp.plotFunction.BaseComponent', // This class extends from amdaPlotComp.plotFunction.BaseComponent
title: "FFT Arguments", // The title of this component
id: 'fftComboBox', // The id of this component
/**
* Initializes the component.
* It creates a combo box with two options, 'Frequency' and 'Period', and adds it to the component.
*/
initComponent: function () {
const me = this;
// Define combo box store
const comboStore = Ext.create('Ext.data.Store', {
fields: ['label', 'value'],
data: [
{ label: 'Frequency', value: 'Frequency' },
{ label: 'Period', value: 'Period' }
]
});
// Create combo box
const fftCombo = Ext.create('Ext.form.field.ComboBox', {
itemId: me.id, // Add itemId here
fieldLabel: 'Abscisse',
store: comboStore,
queryMode: 'local',
displayField: 'label',
valueField: 'value',
editable: false,
value: 'Frequency'
});
// Assign items to the component
me.items = [fftCombo];
// Call the parent class's initComponent method
me.callParent(arguments);
},
/**
* Retrieves the selected value from the combo box.
* Returns an object with a property 'abscisse' set to the selected value.
*/
getValues: function () {
const fftComboBox = this.down('#' + this.id); // Retrieve ComboBox by itemId
const selectedValue = fftComboBox.getValue(); // Get selected value
return {
abscisse: selectedValue
};
}
});