cancel
Showing results for 
Search instead for 
Did you mean: 

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

MikeB
Contributor
0 Kudos

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.

Accepted Solutions (1)

Accepted Solutions (1)

MikeB
Contributor
0 Kudos

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!

Answers (3)

Answers (3)

Former Member
0 Kudos

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

MikeB
Contributor
0 Kudos

Hi,

I've tried to define CN in views and pass/access data via binding, but this didn't solve my issue.

May be we're facing with the differen instances of CN/CP in different views?

praveen_kumar194
Active Contributor
0 Kudos

this is strange. did you check the order in which these methods are called. if there are two views V1 AND V2. one must be default view in runtime repository. are you setting your component controller context node in this view method. share your inputs if it is possible.

MikeB
Contributor
0 Kudos

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?

Former Member
0 Kudos

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

MikeB
Contributor
0 Kudos

1. I've checked this idea, and found out that when you access to this CN from V2, it's clean, but when you access from V1, it's full. So, I suppose, CN clearing is not a case.

What I'm really thing, that the reason for that problem is different instances of component controller's CN. But, according to comments in that thread, CN of component comtroller is a singelton and there is no different instances for component controller and it's context node.

How exactly can I check that I'm really working and try to access to the same instance of component controller and context node inside?

Former Member
0 Kudos

Hi Mike ,

There might be several methods which get processed when you set the collection of custom controllers context CN in view 2 and when you access the same in V1 . You can check it in debugger how the collection of component controller is getting varied and is also dependent on which method the collection is set and whether that method is succeeded or preceded by the methods in V1 and V2.

You can check the instance no. of the object in debugger.

Regards,

Nithish

MikeB
Contributor
0 Kudos
You can check the instance no. of the object in debugger.

I've checked component ID of comp_controller in two different views and found out that they have different values (C26 vs. C25), so, probably that hints us to different instances of component controllers.

So, is there any way to be sure that I'm working with the same instance?

Former Member
0 Kudos

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.

praveen_kumar194
Active Contributor
0 Kudos

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.