Expand my Community achievements bar.

SOLVED

javascript for conditional formatting of table row

Avatar

Level 2

I have a table on one of my Livecycle forms which has rows that need to be conditionally formatted. A calculation involving the values of two of the cells should determine the background color of the cell. I have tried to implement this, but my lack of experience with the Livecycle javascript API is keeping me from being able to get anything out that doesn't just report "Syntax Error" (of course without saying what is invalid...I find Javascript development inside the workbench script window to be extremely frustrating).

This seems like something that would be very common to do in a table, so I was hoping someone could post their script code so I could take a look at it. I should also mention that the rows are repeating rows, and are based on XML data in an attached datasource.

Thanks,

Mike

1 Accepted Solution

Avatar

Correct answer by
Level 6
12 Replies

Avatar

Level 2

A calculation involving the values of two of the cells should determine the background color of the cell

This should read:

A calculation involving the values of two of the cells on a row should determine the background color of each cell in that same row.

Avatar

Former Community Member

If you posted a sample of what you are looking for it might help us visulaize what you are doing.

Paul

Avatar

Level 2

I'm not sure how to post a sample here, buts its a very simple thing I'm trying to do:

I have a table designed in Livecycle Form Designer.

I want the rows of the table to be, say, red when a specific cell on that row has a certain value.

Otherwise, I want the rows to be white (the default).

Avatar

Former Community Member

Ok now I get it .....I modifed a sample that I had. The code is on th exit event of the quantity field. If you enter a value greater than 9 then the whole row will change color.

Paul

Avatar

Level 6

Mike, the process is slightly different if you want to deal with repeating rows bound to an XML dataset.  There is an event on the row called "indexChange" that will fire as each row is created and bound to your data.  Inside that event you can check the data and change the color of the row.  See the attached sample form and xml data.

Avatar

Level 6

Sorry, my attachment was kicked off.  PDF now attached.

Paul, .XDP files are still being rejected...

Avatar

Former Community Member

I know ...I can only put requests in ...I do not control the forum software.

Paul

Avatar

Level 2

Can you zip it up and attach it?

Avatar

Level 2

Sorry, I mean the last message to be in reply to you. Can you zip the xdp?

Avatar

Correct answer by
Level 6

Here you go...

Avatar

Level 2

Awesome...thank you. That is easier than I thought it was going to be.

Avatar

Level 1

Hi Paul,

could you please post the script of the exit event from your attachment "Purchase Order_add specified row.pdf" here that changes the row color.

I don't see how to extract that from the attached pdf.

Thank you very much.

Regards,

Thorsten