cancel
Showing results for 
Search instead for 
Did you mean: 

Create empty Table for input

Former Member
0 Kudos

I want to create a table with 10 colums. The colums should be empty so the user can input some values.


ArrayList emptyTable = new ArrayList();
		
	for (int i = 0; i < 10; i++) {
			
	// Create empty Entries
	elem = wdContext.nodeXXX().createXXXElement();
		elem.setFirstName("");
		wdContext.nodeXXX().addElemen(elem);
	}

Does someone know a better way?

Accepted Solutions (0)

Answers (6)

Answers (6)

Former Member
0 Kudos

Hi,

Code what you have posted is for creating elements for a node.

Is this your requirement?

You can change the above code to as follows



for (int i = 0; i < 10; i++) {
	// Create empty Entries
	elem = wdContext.nodeXXX().createXXXElement();
	wdContext.nodeXXX().addElemen(elem);
	}

Regards

Ayyapparaj

Former Member
0 Kudos

At first: I mean rows

The code works fine. The problem is that when the user click from one row to next row its during 2 - 3 seconds before the user can input some values...

It s look like a server roundtrip...

Is it possible that the user can click into the next row without waiting before he can insert same values?

Any performance suggestions?

former_member197348
Active Contributor
0 Kudos

Hi,

If you are using NW04s version, you can change table properties like this and try.

Compatibiltymode -> nw04Plus

regards,

Siva

Former Member
0 Kudos

Where have I to do this? Directly in NDWS in Layout Tab on table property?

What has that for impacts?

Former Member
former_member201361
Active Contributor
0 Kudos

Hi,

In View Insert a Table and create a Node Element and the Corresponding Attributes according to the number of column.

and bind the data Source Property of the Table with the NodeElement and Insert Columns , headeramd table cell editor like Text View or Input Field or anything.

Bind the Property of the table Cell Editor with the Node Attributes .

Finally in the DoInit Method set the values entered by the user with the Node Attributes .

INodeElement nodeElement = wdContext.CreateNodeElement();

nodeElement.setAttribute();

and finally add the elemnt .

wdContext.nodeNodeElement.addElement(nodeElement);

if you are sure that user is going to enter all the 10 columns(In all the visible rows) use for loop .else use if condition within the for loop , if the user enter only 2 rows

if( wdContext.currentNodeElement.getAttribute!= null )

Former Member
0 Kudos

Hi

u can do like below.

1)create a table

2)Create a Valuenode Emp

3)Under EMP node create two attributes empno,ename.

4)Then u can attch the datasource property to the Emp node.

5)Then u can fill the columns manually like below

IPrivateview1.IEmpNode node1=wdContext.nodeEmp();

IPrivateView1.IEmpElement ele;

ele=node1.createEmpElement();

ele.setEmpno("1");

ele.setEname("Ram");

node1.addElement(ele);

ele=node1.createEmpElement();

ele.setEmpno("2");

ele.setEname("Raj");

node1.addElement(ele);

Note:In the above View1 is the view name

Regards

Hazrath

Former Member
0 Kudos

Hi SAP User,

I don;t know why you are following this way.

You can directly use the table UI element in to view and add a column with ColumnCellEditor. There is one more option on number of columns that you can set according to your requirement.

No need of any code and get the values directly from context elements that you bind to the UI Element.

Hope this may solve your Qust.

Regards

- Vinod

*

sridhar_k2
Active Contributor
0 Kudos

I dont see any problem with that code, with except setting first name.

for (int i = 0; i < 10; i++) {

// Create empty Entries

elem = wdContext.nodeXXX().createXXXElement();

wdContext.nodeXXX().addElemen(elem);

}

Regards,

Sridhar

Former Member
0 Kudos

Hi,

According to your code -

Context

nodeXXX

\

FirstName

Ten elements created for the node .

So , i think they are rows ............not columns

FirstName = ""

FirstName=""

-


When you refer to a column ,,,, there must be different attributes...like

Context

nodeXXX

\

FirstName

SecondName

LastName

Address

Phone number...

-


Code wise , when you have decided fixed number of columns ...for loop is essential.

Your code is OK . but take care of what u r doing ,,,whether rows or columns???

xxxxxxxxxxxxxxxxx

Let me know , further if u have any doubts.

Thanks ,

Srini

Edited by: Armin Reichert on Apr 26, 2008 6:57 PM