1

With reference to: Event “press” on sap.m.CustomListItem doesn't work, I've tried the same solution , but the press event isn't fired.

<List growing="true" growingScrollToLoad="true" id="employeeMasterList" includeItemInSelection="true"
    items="{path: '/EmployeeSet'}">
    <items id="employeeMasterListItems">
        <CustomListItem id="employeeMasterListItem" type="Active" press="onSelect">
            <Label text="Test" />
        </CustomListItem>
    </items>
</List>

In the controller I have the following method:

onSelect: function(oEvent) {
    console.log("onSelect", oEvent);
}

With Type DetailAndActive I can fire the detailPress event, but nothing else.

Any idea?

Sorry for duplicate post. Unfortunately, I can not add a comment to the mentioned question due to missing reps.

Community
  • 1
  • 1
srz
  • 129
  • 1
  • 1
  • 11
  • 1
    You can try to use the `selectionChange`- or `itemPress`-Event from the List that contains the items. – herrlock Mar 15 '16 at 09:54

2 Answers2

2

Check the documentation. The press event is not fired if includeItemInSelection is set to true. You might also have a look at this fine compilation of information.

Community
  • 1
  • 1
matbtt
  • 4,230
  • 19
  • 26
0

I solved this problem by adding sap.m to the data-sap-ui-libs inside my index.html. It seems to be that the events of sap.m controls are not properly fired if the library is not preloaded.

<script src="resources/sap-ui-cachebuster/sap-ui-core.js" id="sap-ui-bootstrap" data-sap-ui-libs="sap.ui.commons, sap.m data-sap-ui-appCacheBuster=" ...and so on... >" </script>

srz
  • 129
  • 1
  • 1
  • 11