Skip to Content
author's profile photo Former Member
Former Member

Dynamic Tables: TableCellEditor depending on Context node value

Dear community,

I'm creating a dynamic table containing all the neccessary fields to display my context node in Java code but I have one requirement that I can not resolve by myself:

Depending on the value of a cell the TableCellEditor should be of type IWDTextView or LinkToURL. So if the context node value is e.g. the String "abc" I want to display a LinkToUrl containing a Target - such as http://www.abc.com - depending on the value, if the context node value is "def" I want to do nothing but display the value in a TextView.

As I am creating the dynamic table in advance and binding my Context node to it later, I don't know how to change the TableCellEditor at that point of time.

Right now I have the choice to either display all cells of the column as LinkToUrl TableCellEditor or display all cells as TextView - the dynamic table generation itself is no problem for me.

Does anyone have an idea on how to do that? Maybe it is not possible in WDJ right now?

regards,

Christian

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

5 Answers

  • Best Answer
    Posted on Nov 27, 2007 at 01:22 PM

    Hi,

    In the Table column , you can not add more than one table cell editor.

    You can keep 2 columns, one with Textview and other with LinkToURL.

    And you can hide and show the columns according to your requirement.

    REgards,

    Praveen

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Nov 27, 2007 at 01:37 PM

    Hi Christian

    Try this:

    IWDTable theTable=(IWDTable)view.createElement(IWDTable.class,"table");

    IWD TableColumn aColumn=(IWDTableColumn)view.createElement(IWDTableColumn.class,"col");

    if(str.equal("abc"))

    {

    IWDTextView aField=(IWDTextView)view.createElement(IWDTextView.class,"TextView");

    aField.bindText(str);

    aColumn.setTableCellEditor(aField);

    }

    else if(str.equal("def"))

    {

    IWDLinkToURL aField=(IWDLinkToURL)view.createElement(IWDLinkToURL.class,"LinkToURL");

    aField.bindtarget("http://www."str".com");

    aColumn.setTableCellEditor(aField);

    }

    theTable.addColumn(aColumn);

    Best regards,

    Sangeeta

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Nov 27, 2007 at 02:34 PM

    Hello Armin,

    I'm on SP13, guess that's 7.0. Have to find docs about TableCellVariants first, will check other posted solutions as well and reward points accordingly.

    kind regards,

    Christian

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Nov 27, 2007 at 02:09 PM

    Are you on a NW release >= 7.0? If yes, this can be done using table cell variants.

    In NW < 7.0, you could use LinkToURL as table cell editor and disable it for those rows where you want to use a TextView.

    Armin

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Nov 29, 2007 at 09:09 AM

    Hi,

    I resolved this by using a LinktoUrl and attaching some new attributes to my content node rendered in the table. One attribute of type string for the URL itself and the other of type boolean to mark the LinkToUrl as active/inactive.

    Upon creation of the context node content I added those extra attributes to tell the specific URL (or an empty String) plus the boolean field for setting the LinkToUrl active or inactive.

    The use of Cell Variant did not get clear to me, I needed the quickest solution. Maybe SAP's gonna provide the community with a more complex Table example for NW2004s one day...

    Thanks for the help!

    regards,

    Christian

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.