cancel
Showing results for 
Search instead for 
Did you mean: 

Change a row design in a tableview iterator

Former Member
0 Kudos

Hi Everybody!

A simple question :

I have a tableView in a BSP. I want to make a special design for some rows, depending on values.

So I use an iterator, and within the method

RENDER_CELL_START

, I try to write something for

P_STYLE

parameter, something like this :

P_STYLE = '<td style=`background-color:#CCAADD;`>'.

but of course it's not working...

Any idea from BSP professionnals ?

Thanks!

François

Accepted Solutions (1)

Accepted Solutions (1)

maximilian_schaufler
Active Contributor
0 Kudos

This parameter does not actually allow you to enter your own style - I got annoyed by it myself when I started working with iterators.

If you debug a bit into the code of the method R_TXT_CELL of class CL_SAPTABLECELL you come across this part:

IF p_style IS NOT INITIAL.
  SPLIT p_style AT ';' INTO TABLE styletable.
  LOOP AT styletable ASSIGNING <style>.
    SPLIT <style> AT ':' INTO stylename stylevalue.
    TRANSLATE stylename TO LOWER CASE.
    IF stylename EQ 'celldesign'.
...

From this (and the follow-up lines) we can learn that the only style attribute that can be used has to be called <b>'celldesign'</b>, and its allowed values are the ones in the table m_tableview->m_htmlb_tableview->mc_render_lib_d2_rt_validation->_et_stcd (runtime name of course).

For a quick reference, here are the values of this table:

STANDARD

ALTERNATING

TRANSPARENT

NEGATIVE

POSITIVE

TOTAL

SUBTOTAL

SUBTOTAL_LIGHT

BADVALUE_DARK

BADVALUE_MEDIUM

BADVALUE_LIGHT

CRITICALVALUE_DARK

CRITICALVALUE_MEDIUM

CRITICALVALUE_LIGHT

GOODVALUE_DARK

GOODVALUE_MEDIUM

GOODVALUE_LIGHT

GROUP_HIGHLIGHTED

GROUP_HIGHLIGHTED_LIGHT

KEY_MEDIUM

GROUP_LEVEL1

GROUP_LEVEL2

GROUP_LEVEL3

MARKED

FILTER

FILTERICON

POPIN

So, we have to live with this possibility - otherwise you would have to use a HTML element which you place into the cell, and which you can apply your styles to.

Cheers,

Max

Former Member
0 Kudos

Thanks!

I understand better what was the problem...

Unfortuantely, it doesn't work ; I write:

method IF_HTMLB_TABLEVIEW_ITERATOR~RENDER_CELL_START .
   if m_row_ref->MENGE_VAL < 1.
        P_STYLE = 'GOODVALUE_DARK'.
   endif.
endmethod.

And I precise that there's an editable field in the table.

Any idea?

Best regards

François

athavanraja
Active Contributor
0 Kudos

try with the following code.

method
 IF_HTMLB_TABLEVIEW_ITERATOR~RENDER_CELL_START .
    if m_row_ref->MENGE_VAL < 1.
         P_STYLE = '<b>celldesign:</b>GOODVALUE_DARK'.
    endif.
 endmethod.

Regards

Raja

maximilian_schaufler
Active Contributor
0 Kudos

Francois,

as you can see from the code I posted above, the style attributes is/are split up by ":", therefore you still have to enter a value in the format of "name:value", like Raja has in his post.

Former Member
0 Kudos

Thanks a lot for your replies,

Unfortunately, it works poorly with a tableview used as "selectionMode = "LINEEDIT" for exemple.

The style is applied only on the selected row, whereas of course the opposite would have interested me.

Would you have a trick?

Best regards

François

maximilian_schaufler
Active Contributor
0 Kudos

You can of course apply your style parameter according to the state of the row.

I used to pass a reference to my model (or any controller, whatever you need) on to the iterator after creating it, so within the iterator I can acess whatever I need.

Former Member
0 Kudos

Okay,

I don't know yet how it works to implement a model, so I will work around first and get back to you if I'm blocked.

Thanks for your help!

François

Answers (0)