cancel
Showing results for 
Search instead for 
Did you mean: 

show view container elements on click of button in view

Former Member
0 Kudos

Hi All,

I have a view ,in that view I have 1 View Container UI Element.In ViewContainer I have a Table.

I have a button in my view.onclick of that button I want to open a view Container's table.

Could anyone please suggest me what are all the steps i have to follow for this?

Regards,

Karthick

Accepted Solutions (1)

Accepted Solutions (1)

former_member182372
Active Contributor
0 Kudos

Hello Karthick,

1) Create custom controller.

2) Create attribute with type Visibility in custom controller.

3) Add custom controller in "required controllers" for embedded view and for container view.

4) Create attribute with type Visibility in embedded view and container view.

5) Map visibility attribute from custom controller to container view and from custom controller to embedded view.

6) in container view in wdDoInit put wdContext.currentContextElement().setVisible(WDVisibility.VISIBLE);

7) In action handler for button put something like:

final int ordinal = wdContext.currentContextElement().getVisible().ordinal();

wdContext.currentContextElement().setVisible(WDVisibility.valueOf(ordinal%2 + 1));

While clicking on button table would be shown or hidden.

Best regards, Maksim Rashchynski.

Former Member
0 Kudos

Hi Vijith / Makshim,

I started implementing your Suggestions.But I could not not find out the Type as visibility.

I created one Value Attribute.If I try to Map it to type visibility its not there in the list.

Where Can I find out that?

Regards,

karthick

former_member182372
Active Contributor
0 Kudos

Select attribute in context editor. Go to properties. Click on "...". In dialog select "dictionary simple type". In tree above select dictionaries-local dictionary-com.sap.ide.webdynpro.uielementdefinitions-Visibility.

Former Member
0 Kudos

Hi Maksim,

If I want to open another View Container under to the current View container on click of another button what should I do give me sample code as you have given earlier.

Thankx and waiting for your answer,

Karthick

former_member182372
Active Contributor
0 Kudos

Hello Karthick,

If I undersand you correct, If you would open another view under current viewContainer on click of another button it is even more simplier - you don`t need custom controller in this case because you can manage visibility directly in view. Follow Vijith`s instructions: create attribute with type visibility in view context, map visibility property of embedded viewContainer to this attribute, set in wdInit method visibility context attribute to none, in action handler for button set visibility context attribute to visible.

Best regards, Maksim Rashchynski.

Answers (3)

Answers (3)

Former Member
0 Kudos

Hi Karthick,

1.Create a value attribute by name say "visible".

2.Got to properties of this attribute and click on the button with three dot in the Type property.

3.A screen will come with Dictionary and under it Local dictionary.

4.In the local dictionary select com.sap.ide.webdynpro.uielementdefinitions.

5.Here select the value visibility.

6.Now you can change it programattically.

Regards,

Jaydeep

Former Member
0 Kudos

Hi Karthick,

Why dont you put your table in the view itself instead of viewcontainer ui element. And change the visibility of the table by creating a simple type of WDVisibility, map it with visibility property of the table and changing that to WDVisibility.visible on the click of the button.

Regards,

Jaydeep

Former Member
0 Kudos

Hi Jaydeep,

I have to show the table on click of one button and Onclick of another button,I have to show the Gantt chart in the same place where the table is shown.

So that I planned to keep View container.At the run time I can call the required View Container.

Regards,

Karthick

Former Member
0 Kudos

Hi,

1.Create a context attribute of type Visibility.

2.Map this attribute to the visible property of the View Container UI element.

3.You can change the visibility of the View Container UI element by writing the folllowing code in the action of the button

wdContext.currentContextElement().set"Attribute"(WDVisibility.Visible)

But i think it is better to add the table in the view itself and change the Visibility as Jaydeep has suggested.

Regards,

Vijith

Former Member
0 Kudos

Hi all,

If you give me any sample code,that will be much helpful to me.

Thankx,

Karthick