cancel
Showing results for 
Search instead for 
Did you mean: 

Event onSelectionChanged from InteractiveDonutChart doesn't work

rogerio_ribeiro2
Explorer
0 Kudos
92

Hi,

I don't understand why the event onSelectionChanged from the class 

sap.suite.ui.microchart.InteractiveDonutChart isn't called when I click on any segment.
It's been called within a custom section, in a fiori element application.
The method onSectionLoaded is correctly called, but  onSelectionChanged don't. 
When I run the application, the console doesn't bring any errors, neither in the network tab.
 

 

<core:FragmentDefinition 
	xmlns:core="sap.ui.core" 
	xmlns="sap.m"
	xmlns:microchart="sap.suite.ui.microchart" >

	<HBox>

		<microchart:InteractiveDonutChart
			id="idDonutChart"
			selectionChanged="onSelectionChanged"
			press="onSelectionChanged"
			selectionEnabled="true"
			displayedSegments="8"
			segments="{_lgort}">
			<microchart:segments>
				<microchart:InteractiveDonutChartSegment
					value="{QuantityStock}"
					label="{= ${StorageLocation} + ' - ' + ${StorageLocationTxt} }" />
			</microchart:segments>
		</microchart:InteractiveDonutChart>

	</HBox>
</core:FragmentDefinition>

 

 

 

sap.ui.define([
    "sap/m/MessageToast"
], function(MessageToast) {
    'use strict';

    return {
        onPress: function(oEvent) {
            MessageToast.show("onPress");
            debugger;
        },

        onInit: function(oEvent){
            MessageToast.show("onInit");
            debugger;
        },

        onSectionLoaded: function(oSection){
            MessageToast.show("onSectionLoaded");
            debugger;
        },

        onSelectionChanged: function (oSection) {
            debugger;
		},

        press: function(oEvent){
            debugger;
        }
    };
});

 

rogerio_ribeiro2_0-1738938055604.png

 

 
 
 
 

Accepted Solutions (1)

Accepted Solutions (1)

Marian_Zeis
Active Contributor

You need to add your namespace to the press event.
See here for a example: https://ui5.sap.com/test-resources/sap/fe/core/fpmExplorer/index.html#/customElements/customSectionC... 
See here the documentation https://sapui5.hana.ondemand.com/#/topic/a357047be956436ebb1dfebf1aa29af2 

<core:FragmentDefinition xmlns:core="sap.ui.core" xmlns="sap.m" xmlns:l="sap.ui.layout">
	<l:VerticalLayout core:require="{handler: 'SalesOrder/ext/CustomColumn'}">
		<Button text="Custom Button" press="handler.buttonPressed" />
	</l:VerticalLayout>
</core:FragmentDefinition>

I think it works like this as well:

<core:FragmentDefinition 
	xmlns:core="sap.ui.core" 
	xmlns="sap.m"
	xmlns:microchart="sap.suite.ui.microchart" >

	<HBox>

		<microchart:InteractiveDonutChart
			id="idDonutChart"
			selectionChanged="onSelectionChanged"
			press="my.custom.namespace.onSelectionChanged"
			selectionEnabled="true"
			displayedSegments="8"
			segments="{_lgort}">
			<microchart:segments>
				<microchart:InteractiveDonutChartSegment
					value="{QuantityStock}"
					label="{= ${StorageLocation} + ' - ' + ${StorageLocationTxt} }" />
			</microchart:segments>
		</microchart:InteractiveDonutChart>

	</HBox>
</core:FragmentDefinition>

 

rogerio_ribeiro2
Explorer
It worked, thank you Marian

Answers (0)