Quantcast
Channel: SCN: Message List
Viewing all articles
Browse latest Browse all 3548

Dynamic Component Reuse - Change Component Issue

$
0
0

Hello everyone!

 

I am attempting to build a WebDynpro program that uses Component Interfaces and Dynamic Components to display the different pieces of the program.

 

The main component has the following structure
View for selection Screen (using WDR_SELECT_OPTIONS)

Navigates to:

View for Report

Report View has 2 Panels (side by side, Matrix Layout), each panel has a ViewContainerUIElement linked to one of the two Custom Component Interfaces. Each Panel has a toolbar for various buttons related to interacting with the Components that are loaded in its ViewContainerUIElement.

 

During Selection Screen View processing, the appropriate Components are decided upon and loaded into the component usage perfectly. Navigating between the Selection Screen and the Report View, changing the options for which Components are loaded also works flawlessly. So, when executing a navigation between these 2 views, I am able to change which components are set in each ViewContainerUIElement easily.

 

I have decided for the 2nd panel to add a toolbar button to toggle between certain components; this seems like it should be pretty straight forward to me. In action handler for toolbar toggle button:

1. Make decision on which component to set.

2. Destroy Existing component

3. Create new Component.

 

However, when I coded this and ran it, it appears to be working (when stepping through the code; and when observing some other changes based upon which component is loaded into the usage) but does not paint the new component to the screen in the appropriate Panel. The Panel just ends up empty (curiously, the Panel's text is updated to reflect the new component, which is set by using the component usage; proving the component usage actually has the new component in it.

 

Here is the code I am using for the toggle between components:

  DATA:

     lr_node       TYPE REF TO if_wd_context_node,

     lr_elem       TYPE REF TO if_wd_context_element,

     lr_usage      TYPE REF TO if_wd_component_usage,

     lr_graph      TYPE REF TO ziwci_plmr277_task_dur_if_grph,

     ls_components TYPE wd_this->element_components,

     l_new_graph   TYPE wdy_component_name,

     l_string      TYPE string

     .

 

   " Get the current graph

   lr_node = wd_context->get_child_node(

     name = wd_this->wdctx_components

     ) .

   lr_elem = lr_node->get_element( ) .

 

   lr_elem->get_static_attributes(

     IMPORTING

       static_attributes = ls_components

       ) .

 

   " We want to switch which Graph is currently showing with the other

   " graph.

   l_string = l_new_graph = wd_assist->decide_switch_graph( ls_components-graph ) .

 

   " Set the component in this component controller's

   " context

   wd_comp_controller->set_graph( l_new_graph ) .

 

   " Now we want to remove the current component and set the new one.

   lr_usage = wd_this->wd_cpuse_graph( ) .

   IF lr_usage->has_active_component( ) IS NOT INITIAL . " Should always pass

     " Delete the Existing Component

     lr_usage->delete_component( ) .

   ENDIF .

   lr_usage->create_component( l_string ) .

 

   " We also want to refresh this newly loaded graph

   " the Panel text should update on the Modify View Event

   lr_graph ?= lr_usage->get_interface_controller( ) .

   lr_graph->refresh( ) .

 

 

As stated; during navigation between Selection Screen and Report Views, very similar code is executed and it works perfectly; but here, it destroys the old component, creates the new one, but the new component never paints to the screen.

 

Does anyone have any idea why this may be happening? I was suspecting perhaps the Panel element is not painting properly, or something? I'm open for all ideas.

 

This is a nice to have feature of the report I am building, and can get by just disabling this functionality; but I would like to learn what is happening here, since I am pretty new to WebDynpro and this is the first WebDynpro program I am building from scratch.


Viewing all articles
Browse latest Browse all 3548

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>