Skip to Content
0
Former Member
Aug 10, 2005 at 04:32 PM

MVC: Subcontroller and event handling

110 Views

Hello together,

I have the following problem:

I have two controllers, "main" and "sub", both inherting from CL_BSP_CONTROLLER2.

"main" creates a view in ON_REQUEST and I can query events form the main view on DO_HANDLE_EVENT.

The main controller instantiates a subcontroller in it's ON_INIT method.

When including the subcontroller from within the main view using bsp:call, everything works fine - the subcontroller also has all required attribes as passed from main's DO_INIT.

The include looks like this:

sub.do" comp_id="sub" />

and gets rendered fine. FYI: previously I had the sam but with <bsp:parameter /> and w/o instantiation in main's ON_INIT.

However, the subview has a control (dropdown), but I am not able to query it in DO_HANDLE_EVENT:

- When handling in main controller, DO_HANDLE_EVENT is fired but cannot obtain a valid reference to the HTMLB control

- When handling in sub controller, DO_HANDLE_EVENT is not fired, although having dispatch_input( ) in sub's ON_REQUEST.

So I am in a dilemma: where the event is handled I get no reference to the HTMLB component (because being included in the sub view?), on the other side I cannot run DO_HANDLE_EVENT from the subcontroller.

Is a subcontroller's DO_HANDLE_EVENT possible to run at all? Would be nice in order to handle input controls of the according view. Should this not work like in a parent controller (except for navigation calls)?

FYI: checked enough in debugger to know that I do not have typos etc. when querying the control's values 😊

Thanks in advance and regards,

Timo

P.S.: I seem to get a little bit closer: the BSP controller codes comes to a section where it checks if a controller is top-level and quits:

if is_toplevel( ) is initial.
   return.
endif.

How are subcontrollers told that they are subcontrollers? Do they derive from another class indirectly?