Expand my Community achievements bar.

Radically easy to access on brand approved content for distribution and omnichannel performant delivery. AEM Assets Content Hub and Dynamic Media with OpenAPI capabilities is now GA.
SOLVED

FillColor on Click event in table

Avatar

Former Community Member

Hi Guys,

I have a table with some Text populated.

I need to create a form which will highlight the cell when clicked and unhighlight when unclicked.

am having real trouble trying to get this to work.

I currently set the cells to Calculated read only text fields so that they can have click events.

I then used this code:

if(this.fillColor = "255, 255, 255")

{

this.fillColor = "255, 255, 0";

}

if(this.fillColor = "255, 255, 0")

{

this.fillColor = "255, 255, 255";

}

But I am not getting any luck.

Any help would be appreciated!

1 Accepted Solution

Avatar

Correct answer by
Level 10

In your if statement you need to use == instead of =. == tests a value while = assigns a value.

if (this.fillColor == "255, 255, 255") {

   this.fillColor = "255, 255, 0";

}

else {

   this.fillColor = "255, 255, 255";

}

View solution in original post

2 Replies

Avatar

Correct answer by
Level 10

In your if statement you need to use == instead of =. == tests a value while = assigns a value.

if (this.fillColor == "255, 255, 255") {

   this.fillColor = "255, 255, 0";

}

else {

   this.fillColor = "255, 255, 255";

}