on 04-21-2009 8:25 AM
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
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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
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.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
87 | |
10 | |
10 | |
10 | |
7 | |
6 | |
6 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.