Skip to Content
avatar image
Former Member

Hide columns dynamically

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

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

4 Answers

  • Best Answer
    avatar image
    Former Member
    Mar 20, 2007 at 11:03 PM

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

    Armin

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Mar 21, 2007 at 02:33 AM

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

    how-to-create-a-context-attribute-of-type-u0093wdv

    button-action-and-table-visibility

    Regards,Anilkumar

    Add comment
    10|10000 characters needed characters exceeded

  • Mar 21, 2007 at 03:31 AM

    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>implementation sources organise 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

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member

      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

  • avatar image
    Former Member
    Mar 21, 2007 at 12:19 PM

    Thanks, Armin.

    I followed your instructions and it works.

    Add comment
    10|10000 characters needed characters exceeded