on 06-08-2006 8:50 PM
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.
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.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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 ^^.
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
84 | |
24 | |
11 | |
9 | |
7 | |
6 | |
5 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.