cancel
Showing results for 
Search instead for 
Did you mean: 

dynamic modification of a table

Former Member
0 Kudos

Hi there!

I would like to dynamically modify a table (in the model, via Adaptive RFC) at runtime.

1) Remove table columns

2) color rows/cells different colors based on the certain flags.

I have done this before in HTMLb with Java iViews, but never webdynpro. How would I go about this? Which methods would do this? Do I create the table first in the View in design time, then modify it, or everything at runtime?

Thanks!

Cheers,

faB

Accepted Solutions (0)

Answers (5)

Answers (5)

Former Member
0 Kudos
Former Member
0 Kudos

the table is now being modified dynamically, thanks to your help.

Regarding colours, it seems that it is not possible to highlight a single cell or row by changing the background color, like is possible in HTMLb. Has anyone managed to somehow change the font size or color to achieve the same effect?

I suppose another option would be to create an additional column and insert a nice graphic if it is marked as a special row.

Thanks for your input and ideas.

Regards,

faB

Former Member
0 Kudos

Hi faB,

If you would like to change the color of the cell based on some condition then it is possible. You can achieve this using supply function.

1. Refer the blog for "Supply functions in WebDynpro"

/people/sap.user72/blog/2005/03/15/supply-functions-in-webdynpro

2. Under the value node create an attribute (if you want to set the color for all the columns in a single row, if u want to set the different color for each column then you have to create that many no. of value attributes) of type "com.sap.tc.webdynpro.clientserver.uielib.standard.api.WDTextViewSemanticColor".

3. Bind the attribute to the cellEditor's "semanticColor" property.

4. In the supply function method, set the color of value based on the condition.

If you require any further clarification let me know.

Regards,

Santhosh.C

Former Member
0 Kudos

Hello,

final IWDTable table = (IWDTable)view.getElement("<<ID of the table UIEelement>>");

Regards, Anilkumar

Former Member
0 Kudos

Please try

table.removeColumn(<<Index>>)

this will remove the column.

Regards, Anilkumar

Former Member
0 Kudos

Hi Anilkumar,

I cannot get the table function to initialize (first line of code "IWDTable".

thx,

faB

Former Member
0 Kudos

hi,

If u want to remove the elements frm a table column you can get the element(say elem) and use

elem.removeElement()...

(Ya . sorry .. this will remove the row element...not the columns)

And for setting the colour.. u can change the selection colour using themes.. but generally depending on flag u cant change the column as such.

One way is to set the semantic Colour if u r using the text view as the table cell editor

Regards

Bharathwaj

Message was edited by: Bharathwaj R

Former Member
0 Kudos

Not exactly.


final IWDTable table = (IWDTable)view.getElement("id-of-table");
final IWDTableColumn col = table.removeColumn(idx-of-column);
col.destroy();
/* otherwise memory leaks are guaranted */

Code should be placed into wdDoModifyView. It is better to set condition to remove col an col index via some context attribute from action handler.

VS

Former Member
0 Kudos

Hi Valery,

Thanks for the response. However, the (adapted) code wouldn't compile.

In the first line, there was no method ".getElement" of the view. I implemented it like this:

final IWDTable table = (IWDTable)PriceListView.getElement("PriceTable");

also on the last line

col.destry();

didn't exist, only

col.destroyHeader(); or

col.destroyTableCellEditor();

Can you say what i am doing wrong?

Big thanks.

Regards,

faB