cancel
Showing results for 
Search instead for 
Did you mean: 

Change color of table cell

Former Member
0 Kudos

Hi experts,

I have to change dinamically the color of a cell of my table, so I have binded the property Semantic Color of my cell with an attribute type WDUI_TABLE_CELL_DESIGN, but when I set the attribute to value 23 I have a dump...

My code:

node->set_attribute(

name = 'CELL_DESIGN'

value = 23 ).

Where is the error?

Tks!

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi,

In a Table, complete columns can be given a background color by setting the property cellDesign of the corresponding TableColumn accordingly. Binding this property to a context attribute of type WDUI_TABLE_CELL_DESIGN allows to

change the background color of a complete TableColumn dynamically. If the context attribute containing the color value is part of the data node, then the color can be defined dependent on the row. In this case, each cell of a given column can have an arbitrary background color.

Ex: I want the column CARRID to be green when ever it is 'AA'.

In the TABLE UI Element. Go to column UI say CARRID and on properties tab bind cellDesign attribute to CELL_DESIGN attribute of your context node.

Now, you just need to set the CELL_DESIGN value dynamically.

LOOP AT IT_TABLE INTO LS_TABLE.

IF LS_TABLE-CARRID = 'AA'.

LS_TABLE-CELL_DESIGN = CL_WD_TABLE_COLUMN=>E_CELL_DESIGN-GOODVALUE_LIGHT.

ENDIF.

MODIFY IT_TABLE FROM LS_TABLE INDEX SY-TABIX.

ENDLOOP.

This should work fine.

Thanks,

Abhishek

Former Member
0 Kudos

tks, solved!

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi

Can you post the descirption of dump.

Could be many reasons - your node has cardinality 0..n or 0..1 and you are assuming default element and setting property of an attribute. if that so change cardinality to 1..1 or 1..N based on your scenario.

More analysis can be done based on the dump you are getting.

Regards

Manas Dua

Former Member
0 Kudos

Ok, the problem is this: I have a context node (the name is TABLE) and a subnode of this context node (CELL_DESIGN). In this subnode, I have an attribute (CELL_DESIGN_01) and the type of this attribute is WDUI_TABLE_CELL_DESIGN. I have binded this attribute at a property of a column of my graphic table, this property is CellDesign (not SemanticColor). The problem is that when I try to retrieve the istance of my subnode (CELL_DESIGN) this istance is always INITIAL, so when I try to set the attribute I have an error. My main node has cardinality and selection 0...n, my subnode has selection and cardinality 1..n, but my graphic table have to be not selectable. What is the error? Why my subnode is always initial?

Tks a lot

Former Member
0 Kudos

Any suggestion for this? I don't understand why my subnode is always initial... I have updated my subnode and I use:


loop at....
c_index = sy-tabix
   CALL METHOD TABLE->GET_CHILD_NODE
            EXPORTING
              NAME       = 'CELL_DESIGN'
              INDEX      = c_index
            RECEIVING
              CHILD_NODE = NODE.
endloop.

but NODE is always initial.

Cardinality of TABLE is 0...n, cardinality of NODE is 1...n.

Tks a lot...

Edited by: webdynpro.gc on Feb 17, 2010 10:56 AM