cancel
Showing results for 
Search instead for 
Did you mean: 

Context mapping between View and Controller

Former Member
0 Kudos

Dear SDN Community,

When I map a context between the view and the component controller, 2 options exists, one is create a context node structure in the component controller and drag the entire node from left to right(controller to view) and the second option is you create the same node structure in both the view and controller and map it. What is the difference between these two options ? Also if I want to use calculated function for mapping how i can do it ?

Thanks!

Surya

Accepted Solutions (1)

Accepted Solutions (1)

former_member485701
Active Participant
0 Kudos

Hi,

There is not any difference. The difference lies only on the way of mapping.

(1) If you map from controller to view, then your controller's context will always expect the modification from view's context and get updated by view's context modification.

(2) And if you map from view to component then vice versa.

And with calculated function of an attribute, you can do calculation and modify other attributes and context in the getter's of attribute.

Regards,

Praveen

Answers (2)

Answers (2)

Former Member
0 Kudos

Hi,

When I map a context between the view and the component controller, 2 options exists, one is create a context node structure in the component controller and drag the entire node from left to right(controller to view) and the second option is you create the same node structure in both the view and controller and map it. What is the difference between these two options ?

No difference.

Also if I want to use calculated function for mapping how i can do it ?

You cant have a mapped attribute calculated at the mapped end.

Controller----


> View

Attr1 NonCalculated Attr1 Mapped to Controller [Here you cant make it calculated, if you try this will lose its mapping]

Attr1 Calculated Attr1 Mapped to Controller[ Will work as usual]

Regards

Ayyapparaj

Former Member
0 Kudos

There is no difference in the result after mapping by dragging from left to right or right to left.

If you first define the node in the controller and then drag from right to left, you don't have do redundant typing

It's also possible to copy paste nodes or attributes between different context-views.

All nodes have a source. You can't have more than one source. Therefor you can't have a calculated field in the view AND the controller AND they are mapped...

Use calculated fields a lot. This way your code is isolated in its context and your code will be easier to maintain. (if the alternative is to have some secret method updating your custom fields)

Depending on what your field is intended for you should have it as a calculated field either in the view or in the controller. Think MVC.

(spellcheck)

Message was edited by:

Mikael Löwgren