on 08-08-2017 9:23 AM
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 (jquery.sap.global-dbg.js:3395), <anonymous>:2546:129)
at jquery.sap.script-dbg.js:64
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:
oInfo.fFunction.call(oInfo.oListener || 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,
Philipp
EDIT:
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?
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.
Regards,
Sharath
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
What UI5 version are you using? Please provide your code too.
Regards,
Jamie
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I'm using 1.46.11.
I tried to recreate the error minified here. I used exactly the same controls as in my application:
https://jsfiddle.net/qjw6u4xp/
The problem is, it just works there. So I must have another problem I didn't think about.
Any ideas where/in which direction I could take a look?
User | Count |
---|---|
84 | |
24 | |
11 | |
9 | |
7 | |
6 | |
5 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.