cancel
Showing results for 
Search instead for 
Did you mean: 

How to add more values in a Table in WD appl

Former Member
0 Kudos

Hi all,

In my WD appl, I have a table and some editor feilds of type InputField. I can enter only one row, bcoz only one row is enabled. How to add more values like 5 rows in a table.

The code in CustomControiller is:

public void wdDoInit()

{

//@@begin wdDoInit()

Y_Ep_Demo_Po_Create_Input ip=new Y_Ep_Demo_Po_Create_Input(); Yepdemoekpo po = new Yepdemoekpo();

ip.addT_Ekpo(po);

wdContext.nodeY_Ep_CreatePO().bind(ip);

//@@end

}

Plz help me. Here T_Ekpo is of type Table.

Thanks a lot in advance

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi,

To create 5 rows in a table, you need 5 elements of the node bound as the datasource of the table.

So run a for loop, create 5 elements and instead of doing a bind, do an addElement(IWDNodeElement).

Regards,

Satyajit.

Former Member
0 Kudos

Hi Satyajit,

Y_Ep_Demo_Po_Create_Input ip=new Y_Ep_Demo_Po_Create_Input();

Yepdemoekpo[] po = new Yepdemoekpo();

for(int i=0;i<5;i++)

{ip.addT_Ekpo(po<i>);

}

wdContext.nodeY_Ep_CreatePO().bind(ip);

This is the way i did, but its reporting some error like

Cannot conert from Yepdemoekpo to Yepdemoekpo[].

How to do this?

Thanks a lot

Former Member
0 Kudos

Hi

Try this

Y_Ep_Demo_Po_Create_Input ip=new Y_Ep_Demo_Po_Create_Input();

for(int j=0;j<5;j++){

Yepdemoekpo po = new Yepdemoekpo();

ip.addT_Ekpo(po);

}

wdContext.nodeY_Ep_CreatePO().bind(ip);

Kind Regards

Mukesh

Former Member
0 Kudos

Hi Mani,

I have done like what you suggested. But my doubt is whether all the rows will be added or only the last row will be added. I cannot see in backend. How to check this?

Thanks a lot

Former Member
0 Kudos

Hi

all the rows will be added by this method. You can check it by bind a value to the parameter.

Try this

Y_Ep_Demo_Po_Create_Input ip=new Y_Ep_Demo_Po_Create_Input();

for(int j=0;j<5;j++){

Yepdemoekpo po = new Yepdemoekpo();

po.set<Param>(String.valueOf(j));

ip.addT_Ekpo(po);

}

wdContext.nodeY_Ep_CreatePO().bind(ip);

Former Member
0 Kudos

Hi Mukesh,

I have a button called Add next to table row. There shud be intially only one row, when i click the Add btn then another row has to be added. How to do this?

The code in wdInit() method of View is:

public void onActioninsertRow(com.sap.tc.webdynpro.progmodel.api.IWDCustomEvent wdEvent )

{

//@@begin onActioninsertRow(ServerEvent)

wdThis.wdGetPoCustController().executeInsertRow();

IPrivatePoCompView.IT_EkpoElement ele=(IPrivatePoCompView.IT_EkpoElement)

(wdContext.nodeT_Ekpo().createElement());

wdContext.nodeT_Ekpo().addElement(ele);

//@@end

}

Thanks a lot in advance

Former Member
0 Kudos

Hi Mukesh,

The error i got when i clicked on Add button is:

com.sap.tc.webdynpro.progmodel.context.ContextException: DataNodeInfo(PoCust.Y_Ep_CreatePO.T_Ekpo): value node is created without a reference

at com.sap.tc.webdynpro.progmodel.context.NodeInfo.packElement(NodeInfo.java:881)

at com.sap.tc.webdynpro.progmodel.context.MappedNodeElement.<init>(MappedNodeElement.java:36)

at com.sap.demo.app.wdp.IPrivatePoCompView$IT_EkpoElement.<init>(IPrivatePoCompView.java:477)

at com.sap.demo.app.wdp.IPrivatePoCompView$IContextNode.doCreateElement(IPrivatePoCompView.java:56)

at com.sap.tc.webdynpro.progmodel.context.NodeInfo.createElement(NodeInfo.java:854)

at com.sap.tc.webdynpro.progmodel.context.Node.createElementInternal(Node.java:1346)

...

Where and how to write the code to work effectively. The button is properly bound

Thanks

Former Member
0 Kudos

Hi

It Seems that the node which you created in the Custom Controller is not match with the node in Component Controller or View.

Check the Bind of the Node.

Remove the current node from view and component controller .

Re Bind the node from Custom controller to Component Controller and to the View

Kind Regards

Mukesh

Former Member
0 Kudos

Hi Mukesh,

The binding is fine. can you give me any other example/procedure that can add another row on click of a button for a Table.

Thanks for all your inputs

Regards,

Ganesh

Former Member
0 Kudos

Hi

Try this

public void onActioninsertRow(com.sap.tc.webdynpro.progmodel.api.IWDCustomEvent wdEvent )

{

IPrivate<ViewName>.I<Name>Node node = wdContext.node<Name>();

IPrivate<ViewName>.I<Name>Element element = wdContext.create<Name>Element();

element.set<Param>("Value");

node.addElement(element);

}

Kind Regards

Mukesh