cancel
Showing results for 
Search instead for 
Did you mean: 

Table UI element - dynamic cell editor change on runtime

marcin_makowski
Explorer
0 Kudos

Hello,

I have standard table UI element defined on one of the views as part of it's layout, two columns only - KEY and VALUE. Both defined as text cell editor by default. Content of the table is dynamic and different combination of keys and values are presented depending on the app context.

Recently the need arised to (depending on the key value) change the cell editor type for single rows only, dynamically from text to link to action - and to register a triggable event for that with some logic behind (to open new window when link is clicked).

Is it possible at all to have a column in Table UI element with different editor types set dynamically on runtime for different rows? Some cells then wolud still be presented as text, some would have a link to action in them.

If possible can I ask for any hints on how to achieve that?

I imagine that first I have to get somehow a reference to the UI element created when the view is triggered first time, then after I recieve values from backend but prior (or after?) binding it to the table context I would like to evaulate the keys and change cell editors accordingly. Then for changed editors (link to action) I would like to register triggable events (on action) which would call some custom methods for further processing. Please advice.

Best regards,

Marcin

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi,

You can use the cell variants to display different cell editors in different rows.

First in your table column where you want to display different cell editors insert two cell variants

and fill the VARIANT KEY for each cell variant and insert textview under one cell variant and input field

under another cell variant, and bind the text to be displayed to these cell editors, now take an extra

attribute of type string in your node and bind it to the table column property SELECTED CELL VARIANT.

Now depending on your requirement change this attribute to any of the VARIANT KEY defined for cell variants.


 loop at itab into wa.
      if 'YOUR CONDITION'. 
        wa-cellvar = 'VAR1'.                 "cellvar is the attribute which is bound to SELECTED CELL VARIANT 
        else.                                          " of table column
          wa-cellvar = 'VAR2'.                 " VAR1 and VAr2 are the variant keys of cellvariants
          endif.
          modify itab from wa.
      endloop.

Hope this solves your problem.

Answers (3)

Answers (3)

marcin_makowski
Explorer
0 Kudos

Thank you guys!

Looks like Cell Variants are the way to go. Points rewarded!

Cheers,

Marcin

Former Member
0 Kudos

Hi Marcin,

I think you can try using cellvariants and change the celleditor dynamically , I have done it for whole column

But i think it is even possible to do it for each row. just try it out.

former_member184578
Active Contributor
0 Kudos

Hi,

Check cell variants in table : [Cell variants in table UI in WDA|http://wiki.sdn.sap.com/wiki/display/WDABAP/WebDynproforABAPCellVariants]. This might help. As ypou said the table already created. ,check the dynamic programming in Web dynpro ABAP and am not sure about this.

Hope this helps u.,

Thanks & Regards,

Kiran.