Skip to Content

Table UI element - dynamic cell editor change on runtime

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

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

4 Answers

  • Best Answer
    author's profile photo Former Member
    Former Member
    Posted on Feb 09, 2012 at 02:44 PM

    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.

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Feb 09, 2012 at 02:11 PM

    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.

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Feb 09, 2012 at 02:15 PM

    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.

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Feb 09, 2012 at 02:50 PM

    Thank you guys!

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

    Cheers,

    Marcin

    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.