on 07-17-2009 6:59 PM
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!
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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
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!
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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.
User | Count |
---|---|
87 | |
10 | |
10 | |
10 | |
7 | |
6 | |
6 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.