cancel
Showing results for 
Search instead for 
Did you mean: 

Hide columns dynamically

Former Member
0 Kudos

Hi All,

I am developing a web dynpro application (NW2004).

I want to hide some columns in a table when user clicks a button.

Can anyone help me how to do this?

Thanks

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Bind IWDTableColumn.<i>visible</i> property to context attribute of (DDIC) type Visibility. Set attribute value to WDVisibility.NONE to hide column.

Armin

Answers (3)

Answers (3)

Former Member
0 Kudos

Thanks, Armin.

I followed your instructions and it works.

Former Member
0 Kudos

hi..

it is very simple and straightforward.

Just follow the following steps:

1...create a context value attribute(in that view which contains the table) of type IWDVisibility.

2...Now go to the properties of the column of the table which u want to dynamically make inviible.

3...in the visibility property of that column, map it with the context that u created in step1.

4...Now, if u want the visibility to be set dynamically on click of a button, create an OnAction action event for that button & in the implementation of that OnAction, set the visibility of the column by setting the value of tha context created in step1.

For making it invisible on clicking, type the following:

wdcontext.currentcontextelement.set<context name>(WDVisibility.NONE);

For making it visible on clicking, type the following:

wdcontext.currentcontextelement.set<context name>(WDVisibility.VISIBLE);

5...<b>FINALLY, you need to initialize the visibility of the column. you can do that by going to the wdDoInit() method of that view, and set the visibility to either visible or invisible depending upon your requirement</b>

you might need to organise your sources for the WDVisibility class to get imported.

for this, either rightclick in <i>implementationsourcesorganise imports.</i>

or else just type: <i>import com.sap.tc.webdynpro.progmodel.api.WDVisibility;</i>

Please reward some points if you find this answer useful..:-)

Message was edited by:

Hanoz Tarapore

Former Member
0 Kudos

No points for your answer from me.

Ad 1: attribute type not correct

Ad 3: property name not correct

Ad 4: Code sample not correct.

Armin

Former Member
0 Kudos

Check the following for creating context of type WDVisibility and binding it to table

Regards,Anilkumar