cancel
Showing results for 
Search instead for 
Did you mean: 

how to hide the field from the view in the webdynpro application?

Former Member
0 Kudos

Hi Gurus,

I got a requirement where in which ,default layout has the field name Time.......To......... which is (2 input box ) and one lable assigned to the container.........

Now my requirement is to hide this field from the layout for all cases of leave......(all types of leave)....

I got a few inputs from forum that we can achieve this by implementing the following steps..........

Create In context => Value attribute => Say Visibility

Go to its properties

Select com.sap.ide.webdynpro.uielementdefinitions.Visibility

In View Layout

Select UI Element Set Visible property to this context variable Visibility.

In wdDoModifyView() You can set this property to false

wdContext.currentContextElement().setVisibility(false);

Can you people tell me where to create the value attribute........

In the view context or in the component context...........

and field that am talking about is assign to the container you want me to assign this context variable property to all ......Like to input box ,label and the container..........

Please calrify this ASAP...........

Thanks in Advance,

Dharani

Accepted Solutions (0)

Answers (3)

Answers (3)

Former Member
0 Kudos

Hi,

If you want to hide or show UI elements in one view then create the attribute in view's context. But if your requirement is that the visibility of few UI elements in view1 is going to affect in view2 and you need to access that visibility element in view2 then create the value attribute in component controller and map it to both the views.

The decision would be according to your requirement.

Regards,

Murtuza

Former Member
0 Kudos

Hi Murtuza,

Thanks for the input........

My requirement is to hide the field in three views say view1 view 2 and view 3.........

My views are in road map..once the data is enterted in view1(edit view) it will call the next view(review view) once user confirm the data it will call the final view (confirm view)........

All the three view has Time ........to..........field which i need to hide it from the screen........how to do that ..............

Looking forward to hear from you soon..........

Thanks in Advance,

Dharani

Former Member
0 Kudos

Hi,

Create a context variable in the root Component. Do context mapping between all the views and root component.

This will solve your pb.

Regards,

Kiran Yadav

Former Member
0 Kudos

Hi,

1. Define a value attribute of type visibility in component controller.

2. Map this attribute to all the 3 views.

3. Bind the visible property of the Time To fields in all the 3 views with the same value attribute

4. Set the value of this attribute to wdVisibility.VISIBLE(to show) or wdVisibility.NONE(to hide) based on your condition in view1.

5. Now when you would navigate to view2 or view3 the UI element would be visible or not will depend upon the value set in view1.

Rem: the value set in view1 will be reflected in view2 and view3 too.

Regards,

Murtuza

Former Member
0 Kudos

Hi Murtuza,

Thank you so much for the valuable inputs.......

Value are getting passed to other view using interface controller........

I tried applying this change ......while try to bind the attribute of type visibility of component controller with view1 field(which needs to be hide).........am not getting the context of component controller as soon as i clicked the create button its displaying the view context .........

am confused ..........please help meeeeee...........

Thanks in Advance,

Dharani

Former Member
0 Kudos

Hi Murutuza,

As per your guidelines I have created the value attribute in View context (which has the field..... which needs to be hide)inside the value node say FieldVisibility.......and attribute name OldTimeDuration......and I set this value with uidefeneitions Visibility .......

and I bind this vaule with the field property visible(Time.......To..........)which I need to hide...........

Now in the view implementation tab ..........I have coded in the doinit method(since my requirement to hide the field from the layout in all cases).........

wdContext.currentFieldVisibilityElement().setOldTimeDuration(WDVisibility.NONE);

But if I deploy the application and see still am getting the same field dispalying in the screen.........

I even tried putting this code in wdmodifyview method.........same results........

Kindly tell me how to hide the field permenantly from the screen............(without any conditions.)

Thanks in Advance,

Dharani

Former Member
0 Kudos

Hi,

Create the attribute in view say "vis".

Now go to the properties of vis and change its type to com.sap.ide.webdynpro.uielementdefinitions.Visibility from Dictionary.

Now you can use the following wherever you want to use:

wdContext.currentContextElement().setVis(WDVisibility.NONE);

Do remember to map the visibility property of your UI fields to this attribute.

thanks & regards,

Manoj

Former Member
0 Kudos

Hi Manoj......

Hi Murutuza,

As per your guidelines I have created the value attribute in View context (which has the field..... which needs to be hide)inside the value node say FieldVisibility.......and attribute name OldTimeDuration......and I set this value with uidefeneitions Visibility .......

and I bind this vaule with the field property visible(Time.......To..........)which I need to hide...........

Now in the view implementation tab ..........I have coded in the doinit method(since my requirement to hide the field from the layout in all cases).........

wdContext.currentFieldVisibilityElement().setOldTimeDuration(WDVisibility.NONE);

But if I deploy the application and see still am getting the same field dispalying in the screen.........

I even tried putting this code in wdmodifyview method.........same results........

Kindly tell me how to hide the field permenantly from the screen............(without any conditions.)

Thanks in Advance,

Dharani

Former Member
0 Kudos

Hi Dharani,

This should actually work.

But just to check once...

Do one thing create a value attribute directly in the context and not within the node and bind it to the visible property of the input field.

set it to NONE in wdDoInit();

wdContext.currentContextElement().set<attribute>(wdVisibility.NONE);

Please let me know is it still behaving in the same way or not.

Regards,

Murtuza

Former Member
0 Kudos

Hi Murtuza,

You want me to put the code in view (implementation tab) rite..........

I have done that getting same screen..........Do you anyother clue

Thanks in Advance,

Dharani

Former Member
0 Kudos

Hi,

Can you undeploy your application and deploy it again and see the changes are reflecting or not.

Regards

Ayyapparaj

Former Member
0 Kudos

Hi Ayyapparaj,

I have done that....still the field Time......To....... is getting displayed in the layout........

No clue yaar....Please help me to find the root cause of this problem...........

Is there anyother way to hide this field.......

Looking forward to hear from you soon........

Thanks in Advance,

Dharani

Former Member
0 Kudos

Hi,

I dont see any difference between your prev thread

and this.

Can you people tell me where to create the value attribute........

In the view context or in the component context...........

and field that am talking about is assign to the container you want me to assign this context variable property to all ......Like to input box ,label and the container..........

Please calrify this ASAP...........

All this are answered their too......

Regards

Ayyapparaj