private createAggregationSumValuePicker()

in analytics-example-widget/scripts/config/AnalyticsConfigComponent.tsx [91:116]


    private createAggregationSumValuePicker(): JSX.Element {
        let initialSumSelection: string;
        let sumValues: Aggregation[] = [];

        if (this.getStoreState().configOptions && this.getStoreState().configOptions.fields) {
            if (!this.getStoreState().configuration.aggregation ||
                this.getStoreState().configuration.aggregation.aggregationMode == AggregationMode.count) {
                return;
            }

            sumValues = this.getStoreState().configOptions.aggregation.allowedFields; // This should be populated by the action creator after requestData has been called. 
            initialSumSelection = this.getStoreState().configuration.aggregation.fieldReferenceName;
        } else {
            return;
        }

        return <Picker
            className="sum-field-picker"
            itemValues={sumValues}
            initialSelectionId={initialSumSelection}
            getItemId={(item: Aggregation) => item.fieldReferenceName}
            getItemText={(item: Aggregation) => item.displayName}
            onChange={(item: Aggregation) => {
                this.actionCreator.setSelectedAggregationValue(item);
            }}></Picker>
    }