on 12-11-2007 3:10 PM
Is it possiable to access view elements of ONE view from OTHER view in VIEWSET.
Imagine there are 2 views in vieset.
TopView - cell1,1
BottomView,empty view - cell2,1
In TopView There is textbox.User enters data and click continue button.Then the emptyview in cell2,1 is replaced by BottomView.
At this moment the data in TopView need to be reatined.
At present TopView Inputbox is binded to context attribute which inturn mapped to component controller.So data will be reatined in component controller,<b>but it is unable to retain in inputbox in TopView.</b>.
1. Please suggest me how to retain the values in view and avoid referesh/reset ?
2. is it possiable to modify/set the data from context and assign the same to Input elements in other views.
3. Is there any use here with Lifespan property "when_visible" here
Message was edited by:
Raghu v
Hi Raghu,
!)Check your doInit method of view, may be you are clearing context data.
2)About visible property, create 3 value attributes say v1, v2, v3 and assign visible as type(it will be in dictionary). In Doinit method use below code to hide a view
wdContext.cuurentContextElement.setV1(WDVISIBLE.NONE).
In Layout for each view assign above created value attribute for visible property.
Look into below link
[<a href="http://help.sap.com/saphelp_nw04/helpdata/en/0d/141640033ae569e10000000a155106/frameset.htm">http://help.sap.com/saphelp_nw04/helpdata/en/0d/141640033ae569e10000000a155106/frameset.htm</a>
3)To set context use wdContext.cuurentContextElement.setV1("string
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
Through context mapping you can share data between different views.
And life span "when_visible" means , it will always initialize the view.
So change it to framework controlled.
Regards,
Praveen
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Raghu,
3.In your case, Lifespan property must be "<b>framework_controlled</b>", then only it can retain values through out the life time of the Application.
1.It should display the value bound to the Input field, since the context is global. But there may be some other reason.
2.Anyway if you want to set it back in the input field.
In wdDoModifyView() of TopView
you can use this code:
IWDInputField input = (IWDInputField)view.getElement("InputField_ID");
input.setValue(wdContext.currentContextElement().get<attributename>());
regards,
Siva
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Siva,
I am getting nullpointer exception because initially there will be null value.
public static void <b>wdDoModifyView</b>(IPrivateView1 wdThis, IPrivateView1.IContextNode wdContext, com.sap.tc.webdynpro.progmodel.api.IWDView view, boolean firstTime)
{
IWDInputField input = ((IWDInputField)view.getElement("GroupInput_6"));
input.setValue(wdThis.wdGetContext().currentGroupElement().getGroupVal());
}
<b>----
java.lang.NullPointerException
at com.sap.tc.webdynpro.sampleproject.View1.wdDoModifyView</b>(View1.java:149)
at com.sap.tc.webdynpro.sampleproject.wdp.InternalView1.wdDoModifyView(InternalView1.java:452)
at com.sap.tc.webdynpro.progmodel.generation.DelegatingView.doModifyView(DelegatingView.java:78)
at com.sap.tc.webdynpro.progmodel.view.View.modifyView(View.java:190)
at com.sap.tc.webdynpro.clientserver.cal.ClientComponent.doModifyView(ClientComponent.java:397)
at com.sap.tc.webdynpro.clientserver.cal.ClientApplication.modifyView(ClientApplication.java:610)
at com.sap.tc.webdynpro.clientserver.task.WebDynproMainTask.handleActionEvent(WebDynproMainTask.java:372)
at com.sap.tc.webdynpro.clientserver.task.WebDynproMainTask.execute(WebDynproMainTask.java:635)
at com.sap.tc.webdynpro.clientserver.cal.AbstractClient.executeTasks(AbstractClient.java:59)
at com.sap.tc.webdynpro.clientserver.cal.ClientManager.doProcessing(ClientManager.java:249)
at com.sap.tc.webdynpro.serverimpl.defaultimpl.DispatcherServlet.doWebDynproProcessing(DispatcherServlet.java:154)
at com.sap.tc.webdynpro.serverimpl.defaultimpl.DispatcherServlet.doContent(DispatcherServlet.java:116)
at com.sap.tc.webdynpro.serverimpl.defaultimpl.DispatcherServlet.doGet(DispatcherServlet.java:48)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:740)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at com.sap.engine.services.servlets_jsp.server.HttpHandlerImpl.runServlet(HttpHandlerImpl.java:385)
at com.sap.engine.services.servlets_jsp.server.HttpHandlerImpl.handleRequest(HttpHandlerImpl.java:263)
at com.sap.engine.services.httpserver.server.RequestAnalizer.startServlet(RequestAnalizer.java:340)
at com.sap.engine.services.httpserver.server.RequestAnalizer.startServlet(RequestAnalizer.java:318)
at com.sap.engine.services.httpserver.server.RequestAnalizer.invokeWebContainer(RequestAnalizer.java:821)
at com.sap.engine.services.httpserver.server.RequestAnalizer.handle(RequestAnalizer.java:239)
at com.sap.engine.services.httpserver.server.Client.handle(Client.java:92)
at com.sap.engine.services.httpserver.server.Processor.request(Processor.java:147)
at com.sap.engine.core.service630.context.cluster.session.ApplicationSessionMessageListener.process(ApplicationSessionMessageListener.java:37)
at com.sap.engine.core.cluster.impl6.session.UnorderedChannel$MessageRunner.run(UnorderedChannel.java:71)
at com.sap.engine.core.thread.impl3.ActionObject.run(ActionObject.java:37)
at java.security.AccessController.doPrivileged(Native Method)
at com.sap.engine.core.thread.impl3.SingleThread.execute(SingleThread.java:94)
at com.sap.engine.core.thread.impl3.SingleThread.run(SingleThread.java:162)
cardinality 0..n
selection 1..1
Still no change in error..
I have modified as u suggested..
-
try{
input = ((IWDInputField)view.getElement("GroupInput_6"));
input.setValue(wdThis.wdGetContext().currentGroupElement().getGroupVal());
if(wdThis.wdGetContext().currentGroupElement()!=null && wdThis.wdGetContext().currentGroupElement().getGroupVal()!=null)
input.setValue(wdThis.wdGetContext().currentGroupElement().getGroupVal());
}catch(java.lang.NullPointerException e){
}
wdThis.wdGetAPI().getComponent().getMessageManager().reportSuccess(" input - "+input);
Hi Raghu,
If you are using this only for input field, make the cardinality 1..1.
Make this change,
try{
input = ((IWDInputField)view.getElement("GroupInput_6"));
<b>// why are you setting before null check? Comment this
// input.setValue(wdThis.wdGetContext().currentGroupElement().getGroupVal());</b>if(wdThis.wdGetContext().currentGroupElement()!=null && wdThis.wdGetContext().currentGroupElement().getGroupVal()!=null)
input.setValue(wdThis.wdGetContext().currentGroupElement().getGroupVal());
}catch(java.lang.NullPointerException e){
}
Next time,please exactly make the line underline where you are getting the error.Please get back in case there is any problem.
If you have resolved your issue can you please specify the solution.
regards,
Siva
Edited by: Siva Rama Krushna on Dec 21, 2007 6:00 PM
Hi Siva,
thanks for ur answer.My problem got solved for inputField.But i got same problem for Dropdownbyindex.
just like input.setValue(wdContext.currentContextElement().get<attributename>());
for inputfiled wat i have to do for dropdownbyindex
my code is
IWDDropDownByIndex index =(IWDDropDownByIndex)view.getElement("DropDownByIndexCounter");
Regards
Padma N
User | Count |
---|---|
83 | |
24 | |
12 | |
9 | |
7 | |
6 | |
5 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.