cancel
Showing results for 
Search instead for 
Did you mean: 

Dynamic Tables: TableCellEditor depending on Context node value

Former Member
0 Kudos

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

Accepted Solutions (1)

Accepted Solutions (1)

former_member485701
Active Participant
0 Kudos

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

Answers (4)

Answers (4)

Former Member
0 Kudos

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

Former Member
0 Kudos

There is a new article on the advanced table features: See <a href="https://www.sdn.sap.comhttp://www.sdn.sap.comhttp://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/80d81237-b780-2a10-d398-cc33af6bd75c">here</a> and <a href="https://www.sdn.sap.comhttp://www.sdn.sap.comhttp://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/30291df2-b980-2a10-0884-839c4f7f147e">there</a>.

Armin

Former Member
0 Kudos

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

Former Member
0 Kudos

Look <a href="http://help.sap.com/saphelp_nw70/helpdata/en/ed/785a42793d1653e10000000a155106/content.htm">here</a>.

Armin

Former Member
0 Kudos

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

former_member335005
Participant
0 Kudos

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