9
Views
3
Comments
Solved
Javascript OnClick Button
Application Type
Reactive

Hi OS Community,

I'm new in javascripting in Outsystems and I'm doing a component for calendar with Javascript. But I'm having a problem with the compatibility in ES6. Please see pic below

What I needed to do is to have a button in my calendar like the buttons below the calendar.

Does anyone know what is the problem with my code? 


Thank you,
Jeriel


Rank: #170
Solution

Hi Jeriel,

What the warning is saying is that the syntax you are using after the OnClick where you put the symbols '=>':

onClick (index,fp) => {

is only available in ES6, check this link for more info on what is ES6.

What you should do, if you want to support older JS versions,  is use a different syntax, see here.


this: 

    onClick: (index,fp) => {

 should look like this in your code: 

   onClick: function(index,fp){


Hope it helps,

Cheers and Regards,

RR :)

Rank: #2642

Hi Rr,

It worked! Awesome.


Thank you,
Jeriel