cancel
Showing results for 
Search instead for 
Did you mean: 

How to show the content of a table (long text) in a scrollable textbox?

Former Member
0 Kudos

Hi,

I have to say first, many thanks to the ones who answers to threads in this forum, it's very helpfull when we're learning web dynpro!

I have a RFC function that return a table containing a long text (node "it_text", with elements "Tdformat" and "Tdline").

1) I want first to copy all the Tdlines in a new node "text_box" (that I made specially for the screen, it contains only the element "Tdline" [the text itself]);

2) Then I want to show the content of the node "text_box" in a scrollable textbox on the screen (to show 8 lines of text, for example).

How to do that easily? What is the UI Element needed to show that?

Thanks!

Accepted Solutions (1)

Accepted Solutions (1)

former_member182294
Active Contributor
0 Kudos

Hi,

Its very easy to do that. You can use <b>TextEdit</b> UI component for that purpose. Map the value property of TextEdit to you custom attribute. You can use various properties to change the visible rows and columns.

I guess you know the logic to read the text from RFC node and appending it to text_box. Infact you need not to create a node, but you can simply create a Value Attribute and append the RFC data.

Regards

Abhilash

Former Member
0 Kudos

No, I don't know the way to read all the occurence of a node and to write some elements of it in another node.

But I don't want to convert all my table lines into one big string, I want to respect the original formatting (and carriage returns!!!).

Here is an example of the content of the table :

Line 1 : * [User id] 2007/09/06 09:00:00

Line 2 : This is a log!

Line 3 : * [User Id] 2007/09/07 15:07:00

Line 4 : New event added.

Message was edited by:

Emanuel Champagne

former_member182294
Active Contributor
0 Kudos

If you want to display as it is then you can use Table UI element. You can change the design property to 'transparent' and set column header visibility property to none. Then you need not to write any code simple you can map the node to table field.

Even with TextEdit you can achieve what you want. Try this code...

	StringBuffer tmpBuffer = new StringBuffer();
	
	for(int index=0;index<wdContext.nodeLines().size();index++)
	{
		wdContext.nodeLines().setLeadSelection(index);
		tmpBuffer.append(wdContext.currentLinesElement().getLine()+"n");
	}
	wdContext.currentContextElement().setData(tmpBuffer.toString());

Regards

Abhilash

Former Member
0 Kudos

Oh, it looks great! I like this "\n" trick hehe

Many thanks!

Former Member
0 Kudos

This may be what the original poster wanted since it's marked as answered but this will cause every line from the long text table to be on a separate line in TextEdit field.

When I had a similar situation, my users wanted the formatting to be retained. This meant that I had I had to query the format column to determine if the current long text row was a continuation of the previous line. In that case I didn't append a newline ("\n") character.

David

Answers (0)