Skip to Content
Colourful Table in Web Dynpro For a long time I could see only shades of blue and grey in Web Dynpro Tables. But we can actually add more colors to it. For this we have property “cellDesign” in Table Column to set the color for that particular column. But does that mean only one colour for the entire column? Can’t we have different colors for different rows? Yes, we can. Lets see how… Adding Colors to a Web Dynpro Table in 10 simple Steps: 1.     Create a new Web Dynpro project say, ColourfulTableWD. 2.     Create a new Application say, ColourfulTableWDApp In the context, add context node color, and context attributes cellDesign1 and name.   image 3.     In properties for cellDesign1 add type = com.sap.ide.webdynpro.uielementdefinitions.TableCellDesign   image 4.     In properties for name add type = String   image 5.     In Layout, add Table, Table Header, Table Column, Column Header, TableCellEditor   image 6.     In properties for Table, add dataSource= color.   image 7.     In properties for Table Column, add cellDesign=color.cellDesign1   image 8.     In properties for TableCellEditor, add text=color.name   image 9.     In wdDoInit(), add the following code:  for (Iterator i = WDTableCellDesign.iterateValues(); i.hasNext(); )        {        WDTableCellDesign design = (WDTableCellDesign) i.next();        IColorElement e = wdContext.nodeColor().createAndAddColorElement();        e.setCellDesign1(design);        e.setName(design.toString());        }  10.     Deploy and Run the application.   image
To report this post you need to login first.

15 Comments

You must be Logged on to comment or reply to a post.

  1. Valery Silaev
    Sangeeta,

    It would be good to note, that this functionality available only since NW04s for Java, that is currently available only to pilot customers, but not released.

    VS

    (0) 
    1. Anonymous
      Hi Valery,

      That is really an important information which I missed.

      Thanks,
      Sangeeta

      (0) 
  2. Armin Reichert
    Better use the iterator over the enumeration values to ensure you will get all values, even when new values will be added someday.

    Node “Designs”, attribute “Value”.

    wdDoInit():
        for (Iterator i = WDTableCellDesign.iterateValues(); i.hasNext(); )
        {
          WDTableCellDesign design = (WDTableCellDesign) i.next();
          IDesignsElement e = wdContext.nodeDesigns().createAndAddDesignsElement();
          e.setValue(design);
        }

    Armin

    (0) 
      1. Armin Reichert
        Thanks.

        Additionally, you could set the “visibleRowCount” property of the table to -1 and the “footerVisible” property to false.

        This will show all entries without scrollbar.

        Armin

        (0) 
  3. Subramanian Venkateswaran
    Good to know that we can change colours for each cell in a Table and my happiness lasted until I saw Valery’s comments. It is available only for NW 2004s is as important in that weblog as the content in itself.

    Thank you Valery for pointing out in which version this feature is available and thank you Sangeetha for the weblog.

    Subramanian V.

    (0) 
  4. Obaid Al Braik
    Hi,

    We created our own value nodes with name and design as attributes it works fine.

    In one of the scenario, we have data coming from back end system which is stored in a model node and it is mapped to a node (X) in the view.

    The cell design attribute is part of another node(Y).

    node Y has same number of elements as that of node X.

    When we set colors to our table (mapped to Node X for DATA and table column mapped to Node Y for cell design), in this case it is not setting different colors as desired. We found out that the data (node X) is properly iterated and values are displayed (all columns and rows are set to a single color).

    Does it mean that data attributes and cell design attributes have to be in same node ?

    For nodes in View, Controller mapped to Model nodes, new value attributes cannot be added, then how can we achieve this column design color functionality ?

    We are using NW04s SP7 Portal.

    Thanks
    Senthil

    (0) 
    1. Armin Reichert
      Add value node Y as child node (cardinality 1:1, selection 1:1) of node X. This works also for mapped nodes and nodes with structure binding where directly adding attributes is not possible.

      Armin

      (0) 
      1. Senthilkumar Radhakrishnan
        Hi Armin,

        Thanks, It worked (we did a small change, we made the child node Y as Non Singleton node).

        We are facing another issue, when we are trying to display table data in Adobe form. I have used Adobe Designer 7.1 (Table UI element), node is fully populated with the values from back end, but in Adobe Form it is always displaying first row.

        We have NW04s SP7 Portal, Adobe Designer 7.1, Adobe Reader 7.0.5.

        I have raised this issue through OSS. But so far no response.

        Is it a known issue ?

        Thanks
        Senthil

        (0) 
  5. sunil chiluveru
    blog was nice…helpful…and it was very clear…

    but, when i am trying to do this, i am unable to find the simple type in uielementdefinitions.

    how to get this into my netweaver. where can i get that.

    com.sap.ide.webdynpro.uielementdefinitions.TableCellDesign

    thanku

    (0) 

Leave a Reply