cancel
Showing results for 
Search instead for 
Did you mean: 

Dropdown should be hidden but is visible

Former Member
0 Kudos

I have a dropdown by index component which has it's visible attribute bound to the context attribute DISPLAY. DISPLAY is set to cl_wd_uielement=>e_visible-none in the supply function. The dropdown should be hidden dynamically.

However, when the component starts the dropdown is visible which is incorrect. The debugger shows that the context DISPLAY is e_visible-none (01). When a pushbutton is clicked, the dropdown disappears. It seems that the form is rendered before the supply function sets the DISPLAY element to e_visible-none. Is there some way to force the form to "repaint"?

Accepted Solutions (0)

Answers (3)

Answers (3)

Former Member
0 Kudos

Hi,

You can do it by using dynmic coding of DropDownUI in wdModifyView/WdDoInit.

Step1: Instansiate the class of dropdown

Step2: access the properties of dropdown class setVisible/SetEnable.

in your case:- Use setEnable = abap_false, setVisible = abap_true.

Hope this will help you,

Regards

Ravi

Former Member
0 Kudos

Logic for Hide and display of UI element dropdown should NOT be written in the supply method atleast for the use case you have mentioned.

You can put the source for Hide & display at

a) WDDOINIT of the view that displays this dropdown

b) WDDOMODIFY of the view that displays this drop down as suggested in thread ABOVE.

Entire source for populating the SUB NODE can be written a View Level method and called in WDDOINIT.

Greetings

Prashant

Former Member
0 Kudos

Just complementing what Prashant wrote, when you are changing the view elements, it's recomended that you do it in the WDDOMODIFYVIEW method that is called before the view is rendered.

The WDDOINIT method is called immediately and only after the instantiation of the controller.

Regards.

Former Member
0 Kudos

You are all correct that UI Elements can only be modified in WDOMODIFYVIEW. However, there are 2 ways of hiding an element:

1) In WDOMODIFYVIEW by accessing the ui element object of the VIEW

2) Based on context attributes bound to the visible property

Now, context attributes are not supposed to be set in WDOMODIFYVIEW but in supply methods and so my method seems correct but the WD framework is drawing the view before the supply method is called it seems.

Is there any way to ensure supply functions are called before WDOMODIFYVIEW?

Former Member
0 Kudos

Hi Marc,

Shift the source of supply function into a view level method. call this method inside the WDDOINIT( ) of the view

Greetings

Prashant

Former Member
0 Kudos

@Prashant I've just tried calling the supply_function from WDOMODIFYVIEW but that has no effect. The dropdown remains visible although the context attribute DISPLAY=01. The behaviour is unchanged.

Former Member
0 Kudos

Hi Marc, previous reply i suggested WDDOINIT( )

Shift the source of supply function into a view level method. call this method inside the WDDOINIT( ) of the view 🙂

ok lets cut to chase.

you need to divide the functionality of your supply function, logic to show or hide DropDown should be part of call in WDDOMODIFY method. Rest of the logic to populate the node thru supply function should be called under WDDOINIT( ).

Put the source code and the Node names that are in question i can suggets you what to do..

Greetings

Prashant

Former Member
0 Kudos

I added my supply function to the WDOINIT method but now the problem is that WDOINIT is called BEFORE the default window plug is fired. The problem is my application is initialised in the default window plug and until this occurs, no data is available. It seems WDOINIT is too early and WDOMODIFYVIEW is too late.

I do not agree with this:

logic to show or hide DropDown should be part of call in WDDOMODIFY method

WD allows you to display/hide controls based on the context. I do not want to manually hide/show my DropDown but have it shown/hidden based on the context. I know I can do ->SET_VISIBLE() but that's not how it should work.

Former Member
0 Kudos

Hi Marc,

Hope you are aware

if_wdl_core=>visibility_visible " 02

if_wdl_core=>visibility_none " 01

that is to hide you need to bind '01' value and to show you need bind '02'.

From the description you have provideed just add your supply function logic with Hide Display within the Default window Plug, after all the initialization.

if its simply that visibility attribute in your context is to be set simply ONE time Value

example: then it can be change any time before your view is displayed.

m_elem_ctr->set_attribute( Name ='MYVIS' value = if_wdl_core=>visibility_visible ) .

Wddomodify Happens To Be The Last Place Where Ui Element Can Be Modified Just Before Display. You Can Always Modify It Any Number Of Place Before It Though

Greetings

Prashant

Former Member
0 Kudos

It looks like I will have to use the SET_VISIBLE() method after all.

My problem now is that the drop down is in a Row Repeater. How do I access a specific element in a row repeater?

Former Member
0 Kudos

Hello,

I suggest you to set the display attribute in the WDDOMODIFYVIEW method of your view.

In this you can check if the importing attribute FIRST_TIME, that indicates the first time that the view is called, is set and in this case set the display attribute that you created.


METHOD wddomodifyview.
  IF first_time = abap_true.
* SET THE DISPLAY VARIABLE TO NOT DISPLAY.
  ENDIF.
...
ENDMETHOD.

You can get more information about the methods called at runtime in [hook methods|http://help.sap.com/saphelp_nw04s/helpdata/en/45/c87f413e70010de10000000a1550b0/frameset.htm].

Regards.