cancel
Showing results for 
Search instead for 
Did you mean: 

Display property of Table columns

Former Member
0 Kudos

Hi Experts,

In my Webdynpro application in first view two radio buttons are there. In second view one table with multiple columns are there.

The radio button and the value in table is getting populated from BAPIs.

My task is depending on one radio button which i am selecting on the first view, few columns of the table control needs to be hidden.

Can anybody please explain me the logic how to do it.If i can get some code f

Thanks a lot.

Accepted Solutions (1)

Accepted Solutions (1)

former_member201361
Active Contributor
0 Kudos

Hi Srini,

The radio button and the value in table is getting populated from BAPIs.

My task is depending on one radio button which i am selecting on the first view, few columns of the table control needs to be hidden.

get the value from Bapi for ur radio button and set it to some context attribute. and create a action say "select " and bind this action to OnSelect property of radio button.

Create a context Attribute say "tableColumnVisibility" of type IWDVisibility and bind it to the Visibility property of the columns.

in this Action method , do the validation check .

for eg : if(wdContext.currentContextElement.getSelectedKey().equals("Test")){

//Show the required table columns , enable the visibility property

wdContext.currentContextElement.settableColumnVisibility(IWDVisibility.VISIBLE);

}else {

//Hide the table columns

wdContext.currentContextElement.settableColumnVisibility(IWDVisibility.NONE);

}

Hope it helps:

Thanks and Regards

Answers (3)

Answers (3)

Former Member
0 Kudos

Hi,

1)create the value attribute in context saying vis

2)Set its type as com.sap.ide.webdynpro.uielementdefinitions.Visibility

3)create action for the radio button and change the visibilty as none in wdinit

3)map this value attribute to the visible property of the table

4)create context attributes with the required elements and then set the values

5) then again set the visibility as visible.wdContext.currentContextElement().setVis(WDVisibility.VISIBLE);

regards

vishal

Former Member
0 Kudos

Plz see the below thread for help

Former Member
0 Kudos

Say you are using individual radio buttons and both button's "selectedKey" property is bound to the same context attribute "gender" which can have values "male" and "female" (or be NULL).

First, move context attribute "gender" to the component controller, then create a context mapping from both views.

Then you have access to the selected value also in the view containing the table. To control the column visibilities, you can for example use calculated attributes.

Example: (Context of view with table)


Context
- gender (attribute, string)
- column1Visibility (calculated attribute, com.sap.ide.uielementdefinitions.Visibility)
- column2Visibility (calculated attribute, com.sap.ide.uielementdefinitions.Visibility)

Bind TableColumn "visibility" properties to these attributes and implement get-methods like


/* Make this column visible if gender is "male" */
WDVisibility getColumn1Visibility(IContextElement element)
{
  return "male".equals( element.getGender() ) ? WDVisibilty.VISIBLE : WDVisibility.NONE;
}

Armin