Skip to Content
0
Jun 01, 2020 at 03:07 PM

SAPUI5 press on table row, does not fire event.

2033 Views Last edit Jun 01, 2020 at 03:16 PM 2 rev

Hi,
I've been working on simple SAPUI5 aplication in which there is a simple table with data, and I'd like to create a detail view for clicked row, but after adding simple function for testing purposes I've realized that the function never gets fired.

What should I do to have this event fired after clicking any table row?

There is no related errors in console and the code looks like this:

<Table class="sapUiResponsiveMargin" id="resultsTab" width="auto" growing="true" growingThreshold="200"  itemPress="handlePress">
<headerToolbar>
    <Toolbar>
        <Title id="restabtitle" text="{i18n>resTabTitle}"/>
    </Toolbar>
</headerToolbar>
<columns>
    <Column><header><Text text="{i18n>transID}"/></header></Column>
    <Column><header><Text text="{i18n>table}"/></header></Column>
    <Column><header><Text text="{i18n>fieldname}"/></header></Column>
</columns>
<items>
    <ColumnListItem type="Active">
    <cells>
        <Text text="{TransId}" id="transid"/>
        <Text text="{TableName}" id="tablename"/>
        <Text text="{Fieldname}" id="fieldname"/>
    </cells>
    </ColumnListItem>
</items>
</Table>
handlePress: function (oEvent) {
    MessageBox.alert("Hi");
}