cancel
Showing results for 
Search instead for 
Did you mean: 

Changing bgcolor of table row at some index

Former Member
0 Kudos

Hi,

Is it possible to change bgcolor programatically the row at some index of table.

Table is not html-table.

Table is webdynpro table.

Thanks.

Accepted Solutions (0)

Answers (1)

Answers (1)

former_member191569
Active Participant
0 Kudos

Yes, you can bind the properties that control the background color to context attributes of the node binded to the table.

TableNode [node]
    - bgcolor [attribute]
    - ...

Each element of your node (represents each row of your table) can have a different value for the bgcolor attribute and, therefore, you can have rows with different background colors.

Hote it helps,

David

Former Member
0 Kudos

That's only part of the solution.

One has to use a table cell variant and has to bind the "cellDesign" property to the mentioned attribute which must have type "TableCellDesign". Something like


Context
+ Rows (node)
   + cellDesign (TableCellDesign)

Table
+ (GroupedColumn)TableColumn (type: TableColumn)
   + (CellVariant) CellVariant (type: TableStandardCell)
      + (Editor) whatever editor you need in that column

Armin

Former Member
0 Kudos

Hi,

-


.setAttributeValue("bgcolor","red");

it gets error message

unknown attribute bgcolor

Former Member
0 Kudos

Hi,

have you sample code?

thanks.

Former Member
0 Kudos

First create the structure I showed using the View Designer. The names in the parentheses like (Editor) are the role names, for which you get an "Insert <rolename>" context menu entry in the Outline View of the View Designer.

Afterwards, you can set the attribute "cellDesign" per row (node element) inside the supply function for the table's data source node like


void supplyRows(IRowsElement node, ...)
{
  for (...)
  {
    IRowsElement row = node.createAndAddRowsElement();
    row.setCellDesign(WDTableCellDesign.POSITIVE); /* whatever, depending on this row's attributes */
  }
}

Armin

Former Member
0 Kudos

If table was returned execution of RFC.

That time it is not possible adding attribute for cellDesign.

That time what would you recommend?

Thanks.

Former Member
0 Kudos

In that case add a value node (cardinality=1:1, selection=1:1, singleton=false), named for example "Additional", under the data source node and add the "cellDesign" attribute to that node.

In the supply function you can then set the attribute value like


void supplyRows(IRowsElement node, ...)
{
   for (...)
   {
     IRowsElement row = node.createAndAddRowsElement();
     row.currentAdditionalElement().setCellDesign(...);
   }
}

Armin

former_member191569
Active Participant
0 Kudos

There is one point that I do not understand at all, why can't you add a context attribute?

I suppose a model bind has been established and model nodes and model attributes generated in the context matching RFCs interface. Are you binding the table to a model node or a value node? Can't you add a context attribute to that node?

David