Skip to Content

CustomListItem press fires empty event after actual event is done

Hi everyone,

I have a sap.m.list in which I create CustomListItems through binding.

The CustomListItem has the press event:

<CustomListItem type="Active" press="onListItemClicked">

As soon as I add this press event in the XML view (it doesn't matter if I use the event in controller or I don't) I get an error when clicking on a list item:

Uncaught TypeError: Cannot read property 'call' of undefined
    at f.a.fireEvent (EventProvider-dbg.js:229)
    at f.a.fireEvent (Element-dbg.js:427)
    at f.fireItemPress (ManagedObjectMetadata-dbg.js:426)
    at f.eval (eval at evalModuleStr (, <anonymous>:2546:129)

The thing is: my event works just fine, but I don't want the error to be thrown every time someone clicks on an item.

I set a break point on EventProvider-dbg.js:229. The line says: || oProvider, oEvent, oInfo.oData);

I noticed, that this line runs twice: First time it works fine and oInfo has a defined fFunction. Then my event handler is called and everything works. The second time the fFunction is undefined, the error is thrown and the execution stops.

Does anyone have an idea why this could happen?

Thank you and best regards,



I'm using SAP UI5 Version 1.46.11.

I tried to recreate the error on jsfiddle using the exact same controls. The problem doesn't exist there, so it must be something more fundamental. Any ideas how I could debug this/where I could take a look?

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

2 Answers

  • Aug 08, 2017 at 11:39 AM

    What UI5 version are you using? Please provide your code too.



    Add comment
    10|10000 characters needed characters exceeded

  • Aug 08, 2017 at 12:52 PM

    For some reason, the event is being called again. Try to subscribe for event - selectionChange, which is specific to any change by user in the list item selection.



    Add comment
    10|10000 characters needed characters exceeded

    • Ideally should but seems like its getting registered twice. To avoid it, use an event specific to the list - usually when an item is pressed(itempress) or when a change in selection of items in the list(selectionChange).