cancel
Showing results for 
Search instead for 
Did you mean: 

Setting Visibility to Table cell editor

Former Member
0 Kudos

Hi

I created a table and added a colomn to the table in view layout. Cell editor of that colomn contains an image. Based on some conditions , I need to make image invisible in table cell editor of custom colomn.

How can I do it.

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

As usual: Add attribute "Visibility" (DDIC type com.sap.ide.webdynpro.uielementdefinitions.Visibility) under data source node, bind property "visible" of cell editor to this attribute.

To show/hide cell editor in row at index i, use code like (assuming "Rows" is the data source node):

/* hide editor at row i */
wdContext.nodeRows().getRowsElementAt(i).setVisibility(WDVisibility.NONE);

/* show editor at row i */
wdContext.nodeRows().getRowsElementAt(i).setVisibility(WDVisibility.VISIBLE);

Armin

Former Member
0 Kudos

HI Armin

I am trying create Visibility under data source node . As I binded data directly from controller its not allowing me to create new attribute in my datasource node.

My context structure is ZRFC_Input>Output>ZData. Data is in ZData node and I am trying to create it in Visibility Atrribute in this node only.

Can you tell me what might me the solution

Former Member
0 Kudos

If the data source node of the table is a model node, you cannot add new attributes directly, but you can add a value node (cardinality=1:1, selection=1:1, singleton=false) and add the attribute inside this value node.

Armin

Former Member
0 Kudos

Thanks for response . I followed steps which were mentioned by you. But my question is how to set visibility to userdefined column cell editors(not binded from model). I created column with LinktoURL UI element. My understanding is your set a condition for visibility of whole row. Please correct me if I am wrong.

Also please show me how code will be after creating a visibility node in Context.I tried but I am getting syntax errors.

Former Member
0 Kudos

Example:

Context:

Rows (model node)
-- Name (attribute, string)
-- Additional (value node, card=1:1, selection=1:1, singleton=false)
---- EditorVisibility (attribute, type=Visibility)

Data binding:

LinkToAction.visible -> Rows.Additional.EditorVisibility

Make editor in row at index 4 visible if name is not empty:

IRowsElement row = wdContext.nodeRows().getRowsElementAt(4);
row.currentAdditionalElement().setEditorVisibility(row.getName() != null && row.getName().length() > 0
  ? WDVisibility.VISIBLE
  : WDVisibility.NONE);

Ok?

Armin

Former Member
0 Kudos

Thanks for your detailed explanation. I am getting error <b>no child node 'VisibilityTest' at index -1</b> . Can you please help me to resolve problem.

Former Member
0 Kudos

Hi

Visibility test is my Additional (value node, card=1:1, selection=1:1, singleton=false) node from above example.

Former Member
0 Kudos

Have you set selection cardinality to 1:1 and initializeLeadSelection=true?

Armin

Former Member
0 Kudos

I have set selection cardinality to 1:1 and initilizeLeadSelection=true and my cod eis

IPrivate<view>.IRFCElement row =wdContext.currentRFCElement();

for (int i = 0; i < wdContext.nodeRFC().size(); i++) {

row = wdContext.nodeRFC().getZinfoElementAt(i);

row.currentVisibilityTestElement().setImageVisible(<CONDITION>? WDVisibility.VISIBLE:WDVisibility.NONE);

}

Visibility is my value node in RFC model node and ImageVisibility is my visibility attribute.

My error is

com.sap.tc.webdynpro.progmodel.context.ContextException: Node(<View>.<RFC_Input>.Output.RFC): no child node 'VisibilityTest' at index -1

Please suggest me if i need to any changes.