cancel
Showing results for 
Search instead for 
Did you mean: 

Enabling specific elements in a column

Former Member
0 Kudos

Hopefully this is a simple one, but I can't seem to enable / disable specific elements within table?

I want to programmatically enable editing of specific items within a single column. Whenever I try to set the enable flag on or off it makes this change to the entire column.

Is this a limitation of the table or can someone suggest a way around this.

thx.

Accepted Solutions (1)

Accepted Solutions (1)

Rodrigo-Giner
Active Contributor
0 Kudos

enable or disable the entire column is very simple.

now if u want to set the editable/non-editable state in singles fields depending in a condition of another cell. Isnt hard but it's trickly.

the data showed in the table is in a Value Node or in a Model node ?

Im asking this 'cause the implementation has a slight difference.

Former Member
0 Kudos

actually I need to do it for both scenarios ... model and value node.

Rodrigo-Giner
Active Contributor
0 Kudos

I did it with semanticColor property, not sure with enable. but It would be the same.

<u>Value node</u>

1-Create a Value attribute with type boolean set readOnly=true, calculated=true (this will generate a new method in your implementation).

2-Bind the InputField "enabled" property to this boolean attribute.

3-In the implementation go to the new method created, and there u code your condition. For example here I set the semantic color to critical if my Attribute Available (integer) is less than 3:

return element.getAvailable() < 3

? WDTextViewSemanticColor.CRITICAL

: WDTextViewSemanticColor.STANDARD;

<u>Model node</u>

Is the same theory, but u are not allowed to create a value Atrribute in a Model node, yo u have to:

1 -create a Value Node with this setting (Cardinality - 1:1, Singleton - false, Selection - 1:1)

2 - Same step 1 of Value node.

3 - Same step 2 of Value Node.

4 - example code, here I set the semanticColor CRITICAL if my Model Attribute Codcivil (string) is equal to "01".

ITable_userElement parentElement = (ITable_userElement) element.node().getParentElement();

String cod = parentElement.getCodcivil();

if (cod.matches("01"))

return WDTextViewSemanticColor.CRITICAL;

else

return WDTextViewSemanticColor.STANDARD;

I hope that this help u, I have to do this yesterday and with the help of Armin I get this working, anyway if I did something wrong someone correct me pls ^^.

Answers (2)

Answers (2)

Former Member
0 Kudos

Add a boolean attribute "Enabled" under the data source node of the table. If this is a model node, add a <b>non-singleton</b> value node (card=1:1, selection=1:1) and add the attribute to the value node.

Bind the "enabled" property of the table cell editor (e.g. InputField" to attribute "Enabled".

Then you can enable/disable the editor in row at index i by setting the value of attribute "Enabled" in node element at index i.

Armin

Former Member
0 Kudos

Hai,

Create a context variable of type boolean and bind this element to whch field you want to give dynamic enabling.

write the code like this in your part

wdContext.currentContextElement.setEnableBool(true);

then the element will enable. if you want to disable set the variable to false.

regards,

Naga Raju