cancel
Showing results for 
Search instead for 
Did you mean: 

How to set a line of table as read only during runtime?

Former Member
0 Kudos

How to set a line (or a cell) of table as read only during runtime?

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi Valery,

A bit confusing. If the cardinality is set to 1..1, how can it determine the status for each line? and why should it be set to singleton?

Former Member
0 Kudos

Wei,

Somehow my post was discarded

1. It should be non-singleton -- otherwise settings for lead selected element will be applied to whole table

2. You may either add calculated attributes here or provide your own supply function. In either way you may determine status from parent element:

a) in calculus: element.node().getParentElement().getAttributeValue("Status")

b) in supply: parentElement is function parameter.

VS

Former Member
0 Kudos

Hi valery,

when a context node use singleton, the supply funtion is only invoked when the component is initialized. So, what if I want the supply funtion invoked everytime the lead selection is changed ?

Former Member
0 Kudos

Hi wei,

For the usage of supply functions and creation of nodes chk out this link.

http://help.sap.com/saphelp_erp2005/helpdata/en/48/70b1c763a45a4a8bc7f2b7d2c171e6/frameset.htm

In the link expand <b>Application of Context Programming and Data Binding</b> to check out for the procedures.

Hope this helps u,

Regards,

Nagarajan.

Former Member
0 Kudos

Hi valery,

I am not so clear about how to use the calculated attribute. could you give me any suggestion?

thank you very much.

btw, I use web dynpro for ABAP.

Former Member
0 Kudos

Wei,

I believe concepts are the same for both Java & ABAP WD.

So, in context node, you have to select attribute, then modify it properties. Namely, you have to set property "calculated" to true. Next, designer will generate for you getter and setter method (setter is available only for writable properties, i.e. readOnly=false) Note, that for calculated properties it is common to be read-only when property just transform some state to UI flag (enabled, visibility, semantic color etc).

VS

Former Member
0 Kudos

Hi Valery,

I didn't find any property named 'calculated' for an attribute in a node. I just find something like readOnly,

primary attribute, etc.

Answers (8)

Answers (8)

Former Member
0 Kudos

hi wei

yes you can create a context node and do it

regards

saravana

Former Member
0 Kudos

can I create the attributes used as indicators in another context node? otherwise I have to create too many new fields in the structure to which the context node binds.

Former Member
0 Kudos

Wei,

Sure you can. Create a sub-node (cardinality 1..1, selection 1..1, non-singleton) under your data node and place your attributes here.

VS

Former Member
0 Kudos

hi wei

if possible try the above said method.check whether it suits you.or else please explain your scenario a bit more

regards

saravana

Former Member
0 Kudos

Currently I use an attribute for all fields of the line for the sake of convenience. If I need to set the display status for some of fields additionally, what can I do ?

Is it good to use the Enabled property for this field ?

Former Member
0 Kudos

hi wei

when you create a table keep the readonly property of table as false

you create the columns of table as inputfield.you bind the readonly property of

the inputfield to two context variables

say one for all the columnfields you to want always have as readonly and let this contextattribute of type boolean and let this be attr1

and another for all the columnfields you donot want to be readonly and let this contextattribute of type boolean and let this be attr2

initially set the context attributes attr1 and attr2 as true so the entire table is readonly.

based on the condition you want to check change the attr2 to be false.

if(your condition)

{

wdcontext.currentcontextelement.setattr2(false);

}

hope this helps.

regards

saravana

Former Member
0 Kudos

Hello,

What if I want some field in this line to be not read-only (according to certain value) when the other fields in this line is set to read-only ?

Former Member
0 Kudos

hi wei

bind the property readonly of the table to a context attribute of type boolean.by default it is false whenever you want a line to act as readonly get the context attribute during runtime and set it to true.when you dont want it to act as readonly change it to false.

regards

saravana

Former Member
0 Kudos

Hi ,

You can make a cell enabled/disabled by using "Enable" property of a UIElement.

Create a valueattribute "enabled" of type boolean and bind the "Enable" property of the table cell editor to the valueattribute.

Regards, Anilkumar