Code_Tech
Code_Tech

Reputation: 795

SAPUI5: Control cannot override Table row click

I have SAP microchart in smart table.

This smart table has navigation to other app, when user clicks on table row (via "itemPress" method).

Now, I implemented StackedBarMicroChart in one of the columns. I implemented onClick method for the StackedBarMicroChart, which inturn opens an popup showing more details.

When I click on StackedBarMicroChart, due to row-click-event of table, I am navigating to another app before StackedBarMicroChart can open the popup.

How can I override this behaviour, so that if I click on StackedBarMicroChart, it opens popup; If I click anywhere else in table row, it navigates to another app?

Thanks.

Upvotes: 1

Views: 311

Answers (1)

aborjinik
aborjinik

Reputation: 753

I guess this issue is not happening with sap.m controls(e.g. sap.m.Button#press event) since those controls, as a convention, mark the (simulated)touch events but the microchart library controls stop the event propagation for the "click" event which is a different (not a touch) event.

In this case maybe you can check the srcControl parameter of the itemPress event and execute your navigation code only if the srcControl is not a microchart. e.g.

onItemPressHandler: function(oEvent) {
    var oSourceControl = oEvent.getParameter("srcControl");
    if (oSourceControl.isA("sap.suite.ui.microchart.StackedBarMicroChart")) {
        return;
    }
    this.navigateToNextPage(...);
}

Upvotes: 1

Related Questions