cancel
Showing results for 
Search instead for 
Did you mean: 

MVC: Layout and detail problems

Former Member
0 Kudos

Hi guys, hope your thinking caps are on

I have a controller which has a drop downlist box and 2 BSP call's to other controllers in the view.

When I select an item from the drop down I want the two other controllers to refresh as well.

I have the controllers declared in my DO_INIT and in my main view they are all between the FORM tags however the two other controllers only refresh at startup and not after I select from the drop down.

I know that the problem is simply that nothing is telling the controllers to refresh and if I do the controllers as "subcontroller" it works but then I loose my formatting, the two controllers are located in the middle of a gridlayout with other items in cells around them.

Thoughts, suggestions? It has to be something easy I am missing.

Accepted Solutions (1)

Accepted Solutions (1)

maximilian_schaufler
Active Contributor
0 Kudos

Hey Craig,

once again, let's start the discussion (will it turn out to become that long again ...?)

I would avoid using the term "refreshing a controller".

Refreshing is linked to the display of the page, whereas the controller is not.

My guess is that you want just the areas, where your 2 sub-controllers (more exactly, their views) reside, to load again when you make a selection in the dropdown.

To clear some uncertainty - should the whole page be loaded again on dropdown selection, or should it not (or does it not matter)? I think you want to use something like onClientSelect, but let's get sure about that before I run into the wrong direction ...

Former Member
0 Kudos

Hey Max,

Controller: manage.do / manage.htm


<%@page language="abap" %>
<%@extension name="bsp" prefix="bsp" %>
<%@extension name="htmlb" prefix="htmlb" %>
<%@extension name="phtmlb" prefix="phtmlb" %>
<%@extension name="xhtmlb" prefix="xhtmlb" %>
<htmlb:content design="design2003" >
  <htmlb:page title="Solution Central" >
    <htmlb:form method = "POST"
                id     = "frmDetail" >
<htmlb:gridLayout columnSize  = "2"
                                    rowSize     = "1"
                                    width       = "100%"
                                    cellPadding = "3"
                                    style      = "ALTERNATING" >
                    <htmlb:gridLayoutCell columnIndex = "1"
                                          rowIndex    = "1" >
                        <bsp:call comp_id="sysstatus" />
                    </htmlb:gridLayoutCell>
                    <htmlb:gridLayoutCell columnIndex = "2"
                                          rowIndex    = "1" >
                         <bsp:call comp_id="dbsize" />
                    </htmlb:gridLayoutCell>
                  </htmlb:gridLayout>
    </htmlb:form>
  </htmlb:page>
</htmlb:content>

DO_INIT


  sysstatus_controller ?= create_controller( controller_name = 'objs/sysstatus.do'
                                      controller_id = 'sysstatus' ).

  dbsize_controller ?= create_controller( controller_name = 'objs/chart/dbsize.do'
                                      controller_id = 'dbsize' ).

DO_REQUEST


* Start event handling
  dispatch_input( ).

* Create view
  default_view = create_view( view_name = 'manage.htm' ).

  default_view->set_attribute( name = 'lv_systemtab'
                               value = lt_itab_sys ).
  default_view->set_attribute( name = 'lv_sid'
                               value = lt_sid ).

* Call view
  call_view( default_view ).

Controller: objs/chart/dbsize.do / dbsize.htm


<%@page language="abap" %>
<%@extension name="htmlb" prefix="htmlb" %>
<htmlb:chart id                  = "myChart"
             data                = "<%= lv_data %>"
             width               = "200"
             height              = "200"
             title               = "Database Size"
             titleCategories     = "Date"
             titleValues         = "Size"
             displayObjectValues = "true"
             chartType           = "AREA_STACKED_3D"
             legendPosition      = "NONE"
             colorOrder          = "STRAIGHT" />

Controller: objs/sysstatus.do / status.htm


<%@page language="abap" %>
<%@extension name="htmlb" prefix="htmlb" %>
<htmlb:tableView id            = "Status"
                 table         = "<%= lv_status %>"
                 iterator      = "<%= iterator %>"
                 footerVisible = "false" />

Former Member
0 Kudos

WAIT!!!!!!!!

I did some more debugging and I think the problem is that the SID is not being updated correctly in my MODEL and therefore the two controllers are taking the inital value.

Former Member
0 Kudos

Yes the problem is that manage.do keeps the value of the SID and stores it to the model however when dbsize.do or sysstatus.do read the model the value is empty.

I also notice that sysstatus.do-DO_REQUEST and dbsize.do-DO_REQUEST fire and run BEFORE manage.do and therefore they would not get the correct value even if it was working.

So I must be doing something wrong in with my model and how I store the value????

So I need an example if anyone can point me in the right direction???

maximilian_schaufler
Active Contributor
0 Kudos

Are you using the same model reference in the controllers?

(... either by sub_controller->set_model() in main ctr or by parent_ctr->get_model() in sub ctr ...)

Maybe you're creating references to initial model objects instead of fetching the existing one?

As to the DO_REQUEST of your sub ctr running before manage.do ... which method of manage.do?

In my program all input processing takes place in SET_ methods of the model (called automatically through data binding).

And, as these methods are executed before DO_HANDLE_EVENT of the triggering controller is called, there you should be able to work with submitted values, DO_REQUEST gets called even later ...

Check for the model reference in the controllers, and specify where exactly you read/write the SID value of the model.

Former Member
0 Kudos

I bet you are right I am problaby just creating a new model reference and not getting the existing one.

sysstatus.do-DO_REQUEST (1)

dbsize.do-DO_REQUEST (2)

manage.do-DO_REQUEST (3)

That is the order that they run.

Former Member
0 Kudos

Thanks Max, it was the way I was getting the MODEL assigned the model in manage.do to the other two controllers and everything worked just fine!

maximilian_schaufler
Active Contributor
0 Kudos

Oh, solved already? No long discussion?

But I got to add something - the order you mentioned for your do_request methods can't be right ...

If manage.htm calls the two other controllers, then how can manage.do-DO_REQUEST be called after all the others?

Former Member
0 Kudos

but that's how the break points come up when I select from the dropdownlistbox.

maximilian_schaufler
Active Contributor
0 Kudos

Form target is manage.do as well?

So it is ...

manage.do -> manage.htm -> subcontroller ...

and still manage.do DO_REQUEST is last in order?

That's one of those things I can't fully believe until I see them or find a reasonable explanation (which I did not yet g).

Former Member
0 Kudos

form target is undefined so that could be why.

maximilian_schaufler
Active Contributor
0 Kudos

ok, by target I actually meant the "action"-attribute ...

but still, if you don't specify the action attribute the form should always call its creation page again, manage.do in your case, as the form tags is placed in manage.htm

Former Member
0 Kudos

Yes I meant the same as well.

You are right that's the way it should work but my break points don't pop up that way. I will check again tomorrow maybe it's just been a long day?

Answers (0)