cancel
Showing results for 
Search instead for 
Did you mean: 

Using URL links in a table

Former Member
0 Kudos

Hello everybody,

I'm working with a 3 column table that's filled up after retrieving data from a function. The last 2 columns of this table have to be links to URLs (for these I used LinkToURL as cell editor for these last 2 columns)... EXCEPT for the last 3 rows of this table, that should always have static text in the 1st and 2nd columns (no links), and a link in the 3rd column like all the other rows.

How can this be done?

Any help would be greatly appreciated.

Thanks!

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

It depends on your Web Dynpro version. Starting with version 7.0 there exist table cell variants that allow you to have different cell editors per row. In NW 04 you could just use a LinkToURL with empty reference and type = WDLinkType.RESULT.

Armin

Former Member
0 Kudos

Hi Armin,

Thanks for your answer. I'm using NW Version: 7.0.16. However, I don't see any properties in the table called "cell variant", or anything like that. Is there anything I have to do before it appears?

Former Member
0 Kudos

Cell variants are aggregated at TableColumn like normal cell editors.

In the "Outline" view, right-click on a TableColumn and select "Insert CellVariant", select for example "TableStandardCell" and set the editor as needed (LinkToURL in your case).

Each cell variant has a property "variantKey" which can be bound to some attribute under the data source node. This allows you to select a different cell variant for each table row (by setting the variant key attribute as needed).

Armin

Former Member
0 Kudos

Cool,

I just found the method public java.lang.String getDataVariant(IPrivateTableFiles.IDataElement element) that is automatically created.

If anyone else is interested, I just added these lines of code and it's now working like I needed it to:

if (element.index() == i-2 ||

element.index() == i-1 ||

element.index() == i){

return "";

} else {

return "varianttest";

}

Thanks a lot for everyone's help in this! I just awarded points.

Cheers!

Former Member
0 Kudos

This method is only generated if you define the "dataVariant" attribute as calculated, isn't it?

Armin

Former Member
0 Kudos

I think you are right... do you know if there's another way to do this without setting it as "calculated"?

Former Member
0 Kudos

In this use case, a calculated (read-only) attribute is adequate. But you could also use a supply function for the data source node instead.

Armin

Answers (2)

Answers (2)

Former Member
0 Kudos

Actually nevermind Armin, I have found the cell variant option.

I've been messing with it a little bit, but I don't think I have the hang of it yet. Here's what I did, maybe you can see what I'm doing wrong:

1- I created my in my context, 1 node named data with 4 attributes in it: name, file, link and variant. All of type string.

2- I did the binding of the node (except of the variant attribute) to my 3 column table. I set columns 1 and 2 to TextView, and column 3 to linktourl.

3- I opened the properties of the file column, and changed the value of "SelectedCellVariant" to "data.variant" from my context.

4- I right-clicked on the file column and selected "Insert CellVariant".

5- I selected TableStandardCell and clicked finish.

6- In the created TableStandardCell, I changed its "variantKey" property to "varianttest".

7- I right-clicked on the TableStandardCell, and selected "Insert Editor".

8- I inserted a LinkToURL editor, and changed its "Reference" and "Text" property to "data.file".

9- I went to my "Implementation" tab and here, everytime I create a new element in my context I have these lines of code:

dataElement = wdContext.nodeData().createDataElement();

dataElement.setName("A" + i);

dataElement.setFile("F" + i);

dataElement.setLink("L" + i + ".html");

dataElement.setVariant("varianttest");

wdContext.nodeData().addElement(dataElement);

10- Except for the last 3 rows, where I change dataElement.setVariant("varianttest"); with dataElement.setVariant("");

The result I get is:

The table is displayed correctly, however, for the 2nd column: only the first row appears as a linktourl... and all the others (including the last 3) appear as static text...

This makes me think that maybe I'm doing something wrong in the implementation code. Any ideas?

Edited by: Alain More on Jul 20, 2009 7:26 PM

Former Member
0 Kudos

hi

hope you are getting data from the RFC and populating the data inthe table ,

you can create a Value Node and bind the attribute to the table , and instead of selecting TEXTVIEW UI forthe

table for the two columns you want to show you can select link to url , and other columns wherethe text should be

static , you can create element for the VALUE NODE and then assign the text you need .

Thanks

Former Member
0 Kudos

Hi Murali,

Thanks for your comment. Actually what you described is what I'm currently doing. I'm getting the data from an RFC and binding the value node's attributes to the table. I did select text view for the 1st column, and linktourl for the last 2 columns. However my problem still stands, since what I need is: for the last 3 rows, set the 2nd column to only show static text, with no links.