on 06-05-2013 6:12 PM
Hi,
I have the following code inside a view(resultView) in my java webdynpro project which works properly and dynamically gets me the header text of a table column to be displayed in a popup message
IWDTableColumn TabCol;
String fldName;
TabCol =(IWDTableColumn)((IWDView)wdThis.wdGetAPI()).getElement(fldName);
fldName1= TabCol.getHeader().getText();
My question is – How can I access the same table column header text from the component controller(of this view)?
Hi Simi,
As per my understanding, you shouldn't be able to play around with view lifecycle in web dynpro - not that you cannot do that, pretty sure you can achieve the same using some reflection.
However, I would suggest you a different approach since seems you have a code working in the View, you need to access the same 'String' in the Component Controller.
1. Create a Attribute in the Component Controller Context, type string;
2. Map that Attribute in the View that you want to extract the "Header" string;
3. Implement wdModifyView, and keep that 'Context Attribute' always up-to-date;
-- This way, each 'Roundtrip' you will be updating the value into the Component Controller's Context;
4. Access the Component Controller Attribute instead of a 'View Attribute' in your Component Controller;
Also note, if you have 'defined times' or 'known scenarios' where this Header is updated, could add a little performance updating the context attribute 'only' when that attribute really has changed.
Hope it helps,
D.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
HI Daniel,
For accessing elements from view to controller or vice versa... you need to create a context mapping between the two and this can be done by using below steps:-
1) create context attribute/node as per the schmea you have ,in view and controller and map them by drag and drop(from right to left)
2) write a code in controller for context binding(as you need to access the view elements into controller)
i hope this way you will be able to access the result view elements in your controller.
Hi Priyanka,
I think you should have addressed your answer to the original thread poster... However, case you are commenting the approach I suggested, there seems to be a ' code snippet ' in the question where the header is being accessed dynamically transversing the View ( his snippet is probably placed inside the wdModifyView ).
One " would / could " dynamically bind the header element as well and access it through the Context, but I took my time to consider the fact he is not accessing a ' bound ' attribute; instead it would appear he is already in wdModifyView with his snippet and " maybe " there is a reason for that...
😃
Hope this clarifies my answer...
D.
what's your original requirement?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
93 | |
11 | |
10 | |
9 | |
9 | |
7 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.