Flexible Columns (FLEXLINE) Row-level Attributes

When using a FLEXLINE control in a control grid, I can define a column in the FLEXLINE as shown:

CONTENTFL.CONTROL    (1) := 'FIELD'
CONTENTFL.VALUEPROP  (1) := 'description'
CONTENTFL.ATTRIBUTES (1) := #ATTR
CONTENTFL.WIDTH      (1) := '100'

I can then assign the value “fieldstyle;background-color:#ffff00” to #ATTR and the column will be populated with yellow FIELD controls for each row of the control grid.

Is there any way to specify the attributes value independently for each row within the grid, so that, instead of the whole column being yellow, only the field on the second row, for example, is yellow?

Edited:
Background for a FIELD control may have been a bad example as it can be done with “bgcolorprop;arrayvariable”, but I’d also potentially like to do it with fieldstyle attributes that do not have associated props.

Hi Todd,

If I understand you correctly then you would like to have alternating colors for the rows of the grid.
You can do this in the following way:

In the repeat set

<str withalterbackground=“true”

Then use the Style Sheet Editor Tool to define the colors. Open the Style Sheet Editor tool and select the “Style Detatils” Tab. Scroll down to the STR node. The relevant style classes are
STRRowEven
STRRowOdd

Is this want you want to do?

Best Regards,
Christine

Thanks for the followup Christine but I wasn’t clear with my question. I don’t want to alternate rows, but rather define control attributes within a FLEXLINE on a row by row basis.

Programatically, using an example where the first control in the FLEXLINE is defined as FIELD, row one and two may not meet my criteria so I would leave the field background the default color, but row three may meet my criteria for highlighting the cell so I would change its background color to yellow.

On a subsequent use of the same FLEXLINE grid, I may want the first control in the FLEXLINE to be defined as a BUTTON, and on an individual row basis, decide that row 1 through 3 buttons are disabled but the row 4 button is enabled.

Right now, in the case of the FIELD, all fields in column one are either the default color or yellow. For the button, I only know that I can enable or disable all buttons in column 1. I’d like to be able to specify each row individually based on runtime conditions.

The reason I am looking into this is because we have the need to display a dozen columns for various scenarios. Many of the columns are standard, but 4-5 columns vary from FIELDS to CHECKBOX to BUTTON controls. Instead of creating pages for each unique scenario, I was hoping to create one page that changes the columns as needed by each scenario. To make this work however, I would need to have greater control over control properties such as background color, enable state, on-click method, etc.

I think I want the FLEXLINE to be more flexible than it actually is, but I have been surprised with some of the solutions others have come up with, so wanted to see if anyone had a way of making this work before I move on to creating multiple pages. I suppose, in lieu of multiple pages, I may be able to use column visibility to obtain the desired results.

Thanks again.

Hi Todd,

part of what you describe is supported in the FLEXLINE control.
For instance setting the background color for single FIELDs in different rows can be done as follows:

Add “bgcolorprop;mycolor” to the CONTENTFL.ATTRIBUTES value.
Add a corresponding XCIDATADEF definition for it.

The NaturalAjaxDemos contain a corresponding sample which shows this:
Natural programm CTRFLL-P and corresponding layout ctrlflexline.xml.

Disabling/Enabling of single BUTTONs you can do in the same way via using the visipleprop property of the BUTTON.

Different controls in the same column depending on the row are more complicated. If you wanted column 1 in rows 1 to be a CHECKBOX and column 1 in row 3 to be a FIELD, you could add both controls with corresponding visibleprop. Then you can dynamically at runtime make one or the other visible. If you just have 1 column like this it might be OK. Doing this for many columns gets rather complex.

Best Regards,
Christine

Thank you Christine.