on 2005 Aug 01 3:18 PM
I would like to create a table which one of it's columns is DropDownByKey list.
The construction of my context is
-> MonthsOfYear Type Node cardinality 0..n
->-> DDLNode Type Node cardinality 1..n
->-> ABCVal Type String
->-> MonthName Type String
I implement the wdDoInit method as following:
public void wdDoInit()
{
//@@begin wdDoInit()
String[] monthNames = new String []
{
"January", "February", "March", "April",
"May", "June", "July", "August",
"September", "October", "November", "December",
};
ISimpleTypeModifiable myType=wdThis.wdGetAPI().getContext().getModifiableTypeOf("MonthsOfYear.DDLNode.ABCVal");
IModifiableSimpleValueSet values=myType.getSVServices().getModifiableSimpleValueSet();
values.put("0","A");
values.put("1","B");
values.put("2","C");
values.put("3","D");
values.put("4","E");
values.put("5","F");
values.put("6","G");
List monthsOfYear = new ArrayList();
for (int i = 0; i < monthNames.length; ++i)
{
IPrivateTableTestView.IDDLNodeElement ddlElement = wdContext.createDDLNodeElement();
IPrivateTableTestView.IMonthsOfYearElement monthElement = wdContext.createMonthsOfYearElement();
monthElement.setMonthName(monthNames<i>);
wdContext.nodeMonthsOfYear().addElement(monthElement);
wdContext.nodeMonthsOfYear().nodeDDLNode().addElement(ddlElement);
wdContext.currentDDLNodeElement().setABCVal("0");
}
//@@end
}
The problem is that after running the application I can see the selected value of dropdown list only on first row of my table. The dropdownlists on other rows are look like empty and I can see the values of these dropdown lists only when I choose the relevant row on the table.
Thanks in advanced for any help
Yoel
Hi,
I have tested the same with the following settings.
MonthOfYear(Cardinality :0..n;Selection :0..1;Singleton :true)
->DDLNode (Cardinality :1..n;Selection :1..1;Singleton :true)
Regards, Anilkumar
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
The node structure is as follows
VnTable
|____Drop
|____AnotherTest
IWDAttributeInfo info=wdContext.nodeVnTable().getNodeInfo().getAttribute("Drop");
ISimpleTypeModifiable st=info.getModifiableSimpleType();
IModifiableSimpleValueSet sv=st.getSVServices().getModifiableSimpleValueSet();
sv.put("1","J");
sv.put("2","F");
for(int i=0;i<5;i++){
IPrivateSDNDropAppView.IVnTableElement ele=wdContext.createVnTableElement();
ele.setAnotherTest("Just a test");
wdContext.nodeVnTable().addElement(ele);
wdContext.nodeVnTable().getVnTableElementAt(i).setDrop("1");
Now the table should display the dropdown with J initially
Regards
Noufal
Hi,
MonthOfYear (Cardinality :1..n;Selection :1..1;Singleton :true)
->DDLNode (Cardinality :1..n;Selection :1..1;Singleton :true)
add the following in the Init method
List monthsOfYear = new ArrayList();
for (int i = 0; i < monthNames.length; ++i)
{
IPrivate<VIEW>.IDDLNodeElement ddlElement = wdContext.createDDLNodeElement();
IPrivate<VIEW>.IMonthsOfYearElement monthElement = wdContext.createMonthsOfYearElement();
monthElement.setMonthName(monthNames<i>);
wdContext.nodeMonthsOfYear().addElement(monthElement);
wdContext.nodeMonthsOfYear().nodeDDLNode().addElement(ddlElement);
wdContext.nodeDDLNode().getElementAt(i).setAttributeValue("ABCVal","0");
}
Regards, Anilkumar
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Anilkumar,
Thank you for your helpful answer. But I have yet afew problems:
1. I think that Singleton of DDLNode should be false. I set it to false and it caused that the DDLs on all rows changed to enabled.
2. In spite of all DDLs are now enabled (Singleton =false)
but only the value of dropdownlist of row 1 is set. the value of DDLs on other rows or still unset.
3. A extra unnecessary row is added to table (the first row)
Best regards
Yoel
Hi Valery ,
I had suggested the same .I am wondering why its not working !!! Any ideas ??
Regards, Anilkumar
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi All,
First of all thank you for your answers. I did not solve the problem yet. Could you please answer the following questions:
1. When I set the DDLnode cardinality to 1..1 I got the followings error:
com.sap.tc.webdynpro.progmodel.context.ContextException: Node(TableTestView.MonthsOfYear.DDLNode): must not add elements to a Node of cardinality 0..1 or 1..1
at com.sap.tc.webdynpro.progmodel.context.Node.prepareAddElement(Node.java:720)
at com.sap.tc.webdynpro.progmodel.context.Node.addElement(Node.java:685)
at yoel.table.test.TableTestView.wdDoInit(TableTestView.java:141)
at yoel.table.test.wdp.InternalTableTestView.wdDoInit(InternalTableTestView.java:123)
at com.sap.tc.webdynpro.progmodel.generation.DelegatingView.doInit(DelegatingView.java:61)
at com.sap.tc.webdynpro.progmodel.controller.Controller.initController(Controller.java:215)
at com.sap.tc.webdynpro.progmodel.view.View.initController(View.java:274)
at com.sap.tc.webdynpro.progmodel.controller.Controller.init(Controller.java:200)
at com.sap.tc.webdynpro.progmodel.view.ViewManager.getView(ViewManager.java:540)
at com.sap.tc.webdynpro.progmodel.view.ViewManager.bindRoot(ViewManager.java:422)
at com.sap.tc.webdynpro.progmodel.view.ViewManager.init(ViewManager.java:130)
at com.sap.tc.webdynpro.progmodel.view.InterfaceView.initController(InterfaceView.java:41)
at com.sap.tc.webdynpro.progmodel.controller.Controller.init(Controller.java:200)
at com.sap.tc.webdynpro.clientserver.cal.ClientComponent.displayToplevelComponent(ClientComponent.java:134)
at com.sap.tc.webdynpro.clientserver.cal.ClientApplication.init(ClientApplication.java:371)
at com.sap.tc.webdynpro.clientserver.task.WebDynproMainTask.execute(WebDynproMainTask.java:599)
at com.sap.tc.webdynpro.clientserver.cal.AbstractClient.executeTasks(AbstractClient.java:59)
at com.sap.tc.webdynpro.clientserver.cal.ClientManager.doProcessing(ClientManager.java:251)
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:391)
at com.sap.engine.services.servlets_jsp.server.HttpHandlerImpl.handleRequest(HttpHandlerImpl.java:265)
at com.sap.engine.services.httpserver.server.RequestAnalizer.startServlet(RequestAnalizer.java:345)
at com.sap.engine.services.httpserver.server.RequestAnalizer.startServlet(RequestAnalizer.java:323)
at com.sap.engine.services.httpserver.server.RequestAnalizer.invokeWebContainer(RequestAnalizer.java:865)
at com.sap.engine.services.httpserver.server.RequestAnalizer.handle(RequestAnalizer.java:240)
at com.sap.engine.services.httpserver.server.Client.handle(Client.java:92)
at com.sap.engine.services.httpserver.server.Processor.request(Processor.java:148)
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)
____________________________________
2. If I set singleton to false and cardinality 1..1 I got the following error:
java.lang.NullPointerException
at yoel.table.test.wdp.IPrivateTableTestView$IContextNode.createDDLNodeElement(IPrivateTableTestView.java:150)
at yoel.table.test.TableTestView.wdDoInit(TableTestView.java:135)
at yoel.table.test.wdp.InternalTableTestView.wdDoInit(InternalTableTestView.java:123)
at com.sap.tc.webdynpro.progmodel.generation.DelegatingView.doInit(DelegatingView.java:61)
at com.sap.tc.webdynpro.progmodel.controller.Controller.initController(Controller.java:215)
at com.sap.tc.webdynpro.progmodel.view.View.initController(View.java:274)
at com.sap.tc.webdynpro.progmodel.controller.Controller.init(Controller.java:200)
at com.sap.tc.webdynpro.progmodel.view.ViewManager.getView(ViewManager.java:540)
at com.sap.tc.webdynpro.progmodel.view.ViewManager.bindRoot(ViewManager.java:422)
at com.sap.tc.webdynpro.progmodel.view.ViewManager.init(ViewManager.java:130)
__________________________________________
3. How can I implement DDL in table without using a particular node for it? Could you please supply more details.
And again Thanks for any comment.
Yoel
Hi Yoel
According to your code, only the currentElement (ie. the element that has been selected presently) will show the initial value.
So, instead of wdContext.currentDDLNodeElement().setABCVal("0"), try
ddlElement.setABCVal("0");
before
wdContext.nodeMonthsOfYear().addElement(monthElement);
wdContext.nodeMonthsOfYear().nodeDDLNode().addElement(ddlElement);
This should surely work.
Regards
Leena
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Leena,
I changed the code as you describe, but after rebuild and redeploy the program nothing changed.
The code now look like following:
for (int i = 0; i < monthNames.length; ++i)
{
IPrivateTableTestView.IDDLNodeElement ddlElement = wdContext.createDDLNodeElement();
IPrivateTableTestView.IMonthsOfYearElement monthElement = wdContext.createMonthsOfYearElement();
monthElement.setMonthName(monthNames<i>);
ddlElement.setABCVal("0");
wdContext.nodeMonthsOfYear().addElement(monthElement);
wdContext.nodeMonthsOfYear().nodeDDLNode().addElement(ddlElement);
//wdContext.currentDDLNodeElement().setABCVal("0");
}
The result is like followig:
-
January | A v |
|----
February | v |
-
March | v |
-
Except of the first row the values of ddl apears after selecting the relevant row.
Thanks for any help.
|
Hi,
It seems you are using a node for the dropdown attribute. That is unnecessary. You can have the dropdown attribute as the child of the root node.
or change the cardinality of the node that conntains the dropdown to 1..1.
IPrivateTableTestView.IMonthsOfYearElement monthElement = wdContext.createMonthsOfYearElement();
wdContext.nodeMonthsOfYear().addElement(monthElement);
wdContext.currentDDLNodeElement().setABCVal("0");
Regards,
Noufal
Message was edited by: Noufal Kareem
Hi,
Make the "Selection" of the DDLNode as 1..1.
Regards, Anilkumar
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
I don;t think this is the right way, but you can try this
wdContext.nodeDDLNode().getElementAt(i).setAttributeValue("ABCVal","0");
insted of "wdContext.currentDDLNodeElement().setABCVal("0");
"
Regards, Anilkumar
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
66 | |
11 | |
11 | |
10 | |
9 | |
9 | |
7 | |
6 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.