cancel
Showing results for 
Search instead for 
Did you mean: 

Adding a Table row on Input field on Enter Action

Former Member
0 Kudos

Hello All,

I want to add row dynamically when press enter on the Input field without null.

Please help .

Thanks in Advance.

CSP

Accepted Solutions (0)

Answers (9)

Answers (9)

BeGanz
Product and Topic Expert
Product and Topic Expert
0 Kudos

Hallo CSP,

there will be a new UI-Element named TableRowCreator to be associated with a Table-UI-Element which exactly does what you want. This new ViewElement will first be available in NW CE 7.1 SP4:

Here is an extract from the IWDTableRowCreator-JavaDoc-API:

Web Dynpro TableRowCreator API.

The TableRowCreator is used to provide a feature which eases the handling of the table for rapid user input. When this feature is enabled by TableRowCreator.Enabled an additional row is shown up at the end of the collection. If the user enters this row by TAB key or by mouseclick an action TableRowCreator.OnCreate is fired. This gives the application the opportunity to add a new NodeElement to the collection. The application has to take care about the focus settings and the right scroll position after the event is fired.

Restrictions:

This feature is only available for the standard table. The TableRowCreator cannot be used in the combination with TableRowArrangement.

Regards, Bertram

Former Member
0 Kudos

hello,

bind the conext attribute of your table column to the inputfield value property.so when u click on particular row,onleadaction performed and selected row will add on inputfield.

hope your problem will solve.

Former Member
0 Kudos

hai pradeep,

To add an empty row here is the coding,

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

{

//@@begin onActionaddrow(ServerEvent)

try

{

IPrivateSalesdet.ITablepartnersNode noder=wdContext.nodeTablepartners();

IPrivateSalesdet.ITablepartnersElement elem;

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

{

elem= noder.createTablepartnersElement();

noder.addElement(elem);

}

}

catch(Exception e)

{

}

call this method on action enter of the inputfield.

Regards

Sharanya.R

Edited by: Sharanya R on Mar 3, 2008 12:35 PM

Former Member
0 Kudos

Hi

Create a action for the input field for which on pressing "Enter" key a row will be created dynamically and the respective data in the input field should will be added in the table.

Example:

Create the following nodes

vnInputNode (vaName1) 1:1 cardinality

vnTableNode(vaName2) 0:n cardinality

Bind the input field with the value attribute vaName1

For that Input field create an action for that , let it be "AddData"...

Implement the following code

public void onActionAddData(com.sap.tc.webdynpro.progmodel.api.IWDCustomEvent wdEvent )
  {
    //@@begin onActionAddData(ServerEvent)
    IPrivateTestView.IVnTableNodeElement tableNodeEle = wdContext.nodeVnTableNode().createVnTableNodeElement();

    tableNodeEle.setVaName2( wdContext.currentVnInputNodeElement().getVaName1());

    wdContext.nodeVnTableNodeData().addElement(tableNodeEle);
        
    //@@end
  }

Regards

Chandran S

Former Member
0 Kudos

Hi,

On Enter do the following


In the following Name of the node is Orders and the name of the attribute is ordertype, replace this with yours

IOrdersElement element = wdContext.nodeOrders().createAndAddOrdersElement();
	  element.setOrderType(0);

Regards

Ayyapparaj

Former Member
0 Kudos

Hi,

1. Create an action and bind it to your input field's OnAction property.

2. Write this code to add row to your table

IPrivate<viewname>.I<tablenode>Element ele = wdContext.node<tablenode>().create<tablenode>Element();

ele.set<attribute>(<value>);

wdContext.node<tablenode>().addElement(ele);

Regards,

Murtuza

Former Member
0 Kudos

Hi,

In the eventhandler method for the onEnter event for the inputfield, just add one more element to the node bound to the datasource attribute of the table.

Regards,

Satyajit.

Former Member
0 Kudos

Hi,

Create an action for onEnter for the inputField. In that you can create an element of the node to which your table is mapped.

IPrivate<View>.I<Node>Element element = wdContext.create<Node>Element();

element.set<attr>("1");

element.set<attr>("2");

*

*

wdContext.node<Node Name>().add(element);

thanks & regards,

Manoj

Edited by: Manoj Kumar on Mar 3, 2008 3:43 PM

Former Member
0 Kudos

Hi.

Add a action to the "onEnter" property in your inputfield.

In your action method, add a row to the table.

/Mikael