Expand my Community achievements bar.

Dive into Adobe Summit 2024! Explore curated list of AEM sessions & labs, register, connect with experts, ask questions, engage, and share insights. Don't miss the excitement.

Scripting Row Shading

Avatar

Former Community Member
I am using a table where I have Apply Alternate Row Shading checked. When a row is deleted by clicking on a delete row button the shading doesn't adjust and the user may end up with two rows with the same shade colour adjacent to each other. Is there a way to get the shading to update with a script when the delete row button is clicked?
4 Replies

Avatar

Former Community Member
Newbie Question: What table tool are you referring to? I am using 30 day trial version 7.0.0 and don't have a table object in my library, but would like to do alternate row shading.

To obtain this affect, I constructed a series of lines in the background. My layout was not dynamic in number of rows, but presumably a script could keep track of how many items you had and apply a shaded line when you add either even or odd records.

Avatar

Former Community Member
I'm using version 7.1 which has tables capability. I used to make my own tables in dynamic forms but they were not always very efficient and predictable. Come to think of it sometimes I have had problems with expanding text fields in tables but not very often.



Anyway there is a feature to turn row shading on and off and be able to specify the colour of the shading.

Avatar

Former Community Member
Steven_Dayton@adobeforums.com wrote:

> I am using a table where I have Apply Alternate Row Shading checked. When a row is deleted by clicking on a delete row button the shading doesn't adjust and the user may end up with two rows with the same shade colour adjacent to each other. Is there a way to get the shading to update with a script when the delete row button is clicked?



The javascript code for the row shading is on the initialize method for each row. This code is

auto-generated by the table wizard. Because it's defined on the initialize method, the row color is

only updated when the row is first created. Move the code from the initialize event to the

layout:ready event and it will update each time your form layout changes.



In my opinion, Adobe's choice to use the initialize event was a poor one.



--

Justin Klei

Cardinal Solutions Group

www.cardinalsolutions.com

Avatar

Former Community Member
Justin,



Thanks very much for the help. That sure did the trick. I would agree with you on the poor choice of events. I did should have poked around more in the script editor. I didn't realize it was a script that worked the row shading. Thanks again for the education.



Steven