cancel
Showing results for 
Search instead for 
Did you mean: 

Problem with "sap.m.ActionListItem"

Mareidem
Explorer
0 Kudos

Hello Experts,

I created a simple list with this code in javascript view:

<<

            var list = new sap.m.List({

                headerText: "MENU'",

                items: [

                  new sap.m.ActionListItem({

                    text: "Inserisci Estratto Conto",

                    press: "ADD_EC"

                  }),

                  new sap.m.ActionListItem({

                    text: "Rendiconto",

                    press : function () {

                            sap.m.URLHelper.triggerEmail(person.email, "Info", "Dear " + person.name + ",");

                          }                   

                  }),

                ]

              });

>>

The second "sap.m.ActionListItem" is ok, but the first doesn't call the function "ADD_EC", that I implemented in the corresponding controller:

<<

        ADD_EC : function(oEvent) {

        alert(oEvent.getSource().getId() + " does it!"); 

        },   

>>

In debug I have this error "Uncaught TypeError: Object D has no method 'call'".

Help me, Please!!

Thanks in advance.

Best Regards,

Marino

Accepted Solutions (1)

Accepted Solutions (1)

seVladimirs
Active Contributor
0 Kudos

Hi,

You need to pass controller when you define press function. More details you can find here: SAPUI5 SDK - Demo Kit

Please also find working code here: http://jsbin.com/siba/1/edit?html,output

Regards,

Vlad

Answers (3)

Answers (3)

Mareidem
Explorer
0 Kudos

Hi guys,

thanks so much.

I solved the problem.

Thanks again.

Best Regards,

Marino

former_member182650
Contributor
0 Kudos

Hi Marino,

Write controllername.functionname without "

Hope this helps,

Cheers

surendra_pamidi
Contributor
0 Kudos

Hi Marino,

You have to call by using "oController.functionname()" to call a function in controller..