FFTCmpt.js 1.29 KB
Ext.define('amdaPlotComp.plotFunction.FFTCmpt', {
    extend: 'amdaPlotComp.plotFunction.BaseComponent',
    title: "FFT Arguments",
    id: 'fftComboBox',
  
    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);
    },

    getValues: function () {
        const fftComboBox = this.down('#'+this.id); // Retrieve ComboBox by itemId
        const selectedValue = fftComboBox.getValue(); // Get selected value

        return {
            abscisse: selectedValue
        };
    }
});