Skip to Content

Direct access to context node of component controller from different views.

Hi,

I have a view V1, view V2, component controller CP and inside of this component controller context node CN.

I fill-in data of CN from method of V1. I've checked it in debugger, the data is really stored in CN of CP.

Now, I want to access the data of this CN from method of V2 and, to my surprise, I can't see the data, stored in CN, this container is empty.

The way I'm trying to access to context node of component controller:

comp_controller->ztyped_context->CONTEXT_NODE->collection_wrapper->get_first( ).

My questions are:

1. What is the reason for that? And how can I access to the stored data in CN via method of V1 from the method of V2?

2. Does comp_controller is a singleton and the same for all views of the same component?

3. Is it appropriate way to access to context node of component controller directly from the view of the same component, without defining a context node inside of view and dealing with the binding?

Thanks.

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

4 Answers

  • Best Answer
    Aug 22, 2012 at 07:56 AM

    Hi, guys.

    I've solved my issue. The problem was in lack of WD_USAGE definition.

    The steps to solve such kind of issue are:

    1. Redefine WD_USAGE

    2. Check what usage you are using and define binding for that usage case

    After that I can read and write data directly to component controller's context node from different views of the same component.

    Thanks to everybody for the help!

    Add comment
    10|10000 characters needed characters exceeded

  • Aug 21, 2012 at 05:44 AM

    1. are you sure that the method of v1 is called first before the method of V2.

    2. I would agree with your point, as we never created instance for component controller programmatically.

    3. this is right, it is not mandatory that we should have context node in our view to access the comp controller context data.

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Aug 21, 2012 at 05:45 AM

    Hi Mike,

    1. The reason might be the CN collection of CP might have got cleared when you start accessing  it from View V2.

    2 .  Yes the instance of CP is single for a component . If you would like to pass the data between the views , you can use a custom controller rather than component controller . The reason behind this is if your component gets exposed , then the data flow will be through component controller , in this case if you use a custom controller it is isolated from outside world.

    3 . If you use a custom controller ( cc) , then create binding between CC and view1 context nodes as well as CC and view2 context nodes . What this makes is that it same instance of collection wrapper will be shared across all these context nodes . So if you just fill one collection , then it will get reflected in all three.

    Regards,

    Nithish

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member Mike B.

      Can you check the object no ( which is the reference no of the object) . Its not an attribute of the comp controller . For every object one reference no is associated  . You can view only in debug mode.

  • avatar image
    Former Member
    Aug 21, 2012 at 05:53 AM

    Hi Mike,

      try to bind the contect node (CN) of the component controller with the same kind of context nodes in both the views. i.e., V1 and V2. then try to access the data .

    Lets see what's gonna happen.

    Regards.

    Ron

    Add comment
    10|10000 characters needed characters exceeded

    • Mike B. praveen kumar mannala

      Hi,

      I've checked the order, with breakpoints order, first of all I'm calling breakpoint of V1 and only after that, breakpoint in V2, so, I'm thinking, the problem is not an order.

      Actually, we have a number of views in GS_CM component, here is an example of window/view structure:

      —MainWindows

                — AddDoc view

                — DocOV overview (default)

                          — EditProp view (default)

      The initial value of CN of component controller is defined in method of AddDoc view and only after that I'm calling view of EditProp view method which tries to read value in that CN.

      Does view status (default/non-default) can really influence to ability to read data from component controller's context node?