cancel
Showing results for 
Search instead for 
Did you mean: 

Hiding View Container UI element

Former Member
0 Kudos

Halo All,

I have a view container UI element. I want to hide this element based on certain condition( i.e dynamic). I have created a node with name VISIBLE with cardinality 1..1 and selection 0..1. In the node VISIBLE, I have created an atrribute ALV_VISIBLE of type WDUI_VISIBLE. Moreover i did the binding of ALV_VISIBLE with view container VISIBLE property. In the VIEW, I have used the method SET_ATTRIBUTE to hide or display the element.

But the problem is that, when i tried to set the value of VISIBLE property, it is setting the value of STATIC ATTRIBUTES. Can anyone tell me why is it happening so??? from yesterday i am not understanding why is it happening so?

Thanks,

Ravi

Accepted Solutions (1)

Accepted Solutions (1)

uday_gubbala2
Active Contributor
0 Kudos

Hello Ravi,

I am not sure as to why it isnt working out for you. I did exactly what you had done and came up with the desired output.

I have a node VISIBLE of Cardinality 1:1 & Selection 0:1.

I have an attribute ALV_VISIBLE under this node of type WDUI_VISIBILITY with a Default Value of 2. (i.e, visible)

I have bound the "visible" property of the ViewContainer to the ALV_VISIBLE. I have also placed a button on my layout to toggle between the visible & invisible states of the ViewContainer. I create an action handler for the button and place the below coding within the same.

method ONACTIONMAKE_INVISIBLE .
  data: wd_node type ref to if_wd_context_node,
        lv_visibility type wd_this->element_visible-alv_visible.

  wd_node = wd_context->get_child_node( name = 'VISIBLE' ).
  wd_node->get_attribute( exporting name  = 'ALV_VISIBLE'
                          importing value = lv_visibility ).

  if lv_visibility = '02'.
    wd_node->set_attribute( name  = 'ALV_VISIBLE'
                            value = '01' ).
  else.
    wd_node->set_attribute( name  = 'ALV_VISIBLE'
                            value = '02' ).
  endif.
endmethod.

Up on execution the ViewContainer gets displayed as I had given a default value of "2" to ALV_VISIBLE. When I click the button the value gets set to "1" and hence the ViewContainer gets invisible.

Regards,

Uday

Former Member
0 Kudos

Halo Uday,

could you tell me something? When i do the mapping with visible property, the value coming as "MAIN.VISIBLE.ALV_VISIBLE:VISIBLE". Is this correct? considering VISIBLE is my node and ALV_VISIBLE is my attribute.

Thanks,

Ravi

arjun_thakur
Active Contributor
0 Kudos

Hi Ravi,

It is correct. It'll come like this only.

Regards.

Arjun

You should close the other similar threads and should continue with this one.

Edited by: Arjun Thakur on Apr 21, 2009 2:34 PM

former_member40425
Contributor
0 Kudos

Hi,

For sake of simplycity do not create node in component controller then mapping.

Simply create a contxet attribute (need not to creater node also) of type wdui_visibility in the MAIN view. And bind it with the visible property of viewcontainer.

To make it visible set it as '02' and to make it invisible set it as '01' .

I hope it helps.

Regards,

Rohit

Answers (2)

Answers (2)

Former Member
0 Kudos

Hi Ravi,

please folow this procedure you will get it

1. create a view (view1) and place a viewcontainer in it.

2. create anthore view (view2) place a lable "I am visible'

3. create a node(node)in the view 1 with cordinality 1:n

4. create a attribute (visible) of type boolean.

5. bind the attribute to visible property of the container in view1.

6. go to window emded view1 then embed the view2 to the view container

7. now in(view1) method WDDOINIT write the following code

method wddoinit .

data lo_nd_node type ref to if_wd_context_node.

data lo_el_node type ref to if_wd_context_element.

data ls_node type wd_this->element_node.

data lv_visible like ls_node-visible.

  • navigate from <CONTEXT> to <NODE> via lead selection

lo_nd_node = wd_context->get_child_node( name = wd_this->wdctx_node ).

  • get element via lead selection

lo_el_node = lo_nd_node->get_element( ).

  • alternative access via index

  • lo_el_node = lo_nd_node->get_element( index = 1 ).

  • @TODO handle non existant child

  • IF lo_el_node IS INITIAL.

  • ENDIF.

  • get single attribute

lo_el_node->get_attribute(

exporting

name = `VISIBLE`

importing

value = lv_visible ).

lo_el_node->set_attribute(

exporting

name = `VISIBLE`

value = ' ' ).

endmethod.

uday_gubbala2
Active Contributor
0 Kudos

Hi Ravi,

I see that you had earlier created another [thread |; for the same issue. In case of any issues you should be following up in the same thread and not create a new one.

Regards,

Uday