行在ADF表中突出显示

时间:2016-10-13 19:51:45

标签: row oracle-adf

请问有人可以告诉我如何为ADF表中的行指定颜色?

四种不同的颜色和序列在表中重复连续的行。

2 个答案:

答案 0 :(得分:0)

        //define style class in skins file 
            .style1 { background-color:green; }
            .style2 { background-color:red;}
            .style3 { background-color:yellow; }
            .style4 { background-color:blue;}

    public long getCountRows(){
   ViewObjectImpl vo = getTourHeaderEOView_hdr();
   return vo.getEstimatedRowCount();
}

答案 1 :(得分:0)

private String styleForCell; //class variable

public String getStyleForCell() {


    OperationBinding ob2 = (OperationBinding)getBindings().get("getCountRows");
    int row = (Integer)ob2.execute();

    for(int i = 1;i <= row;i=i+4) {
       return "style1";
    }
    for(int i = 2;i <= row;i=i+4) {
       return "style2";
    }
    for(int i = 3;i <= row;i=i+4) {
       return "style3";
    }
    for(int i = 4;i <= row;i=i+4) {
       return "style4";
    }

    return null;
}
public void setStyleForCell(String aStyleForCell)
{
    this.styleForCell = aStyleForCell;
}

//现在通过带有styleclass属性的表格在前端页面调用此方法(styleclass =&#34;#{backinbean.styleforcell}&#34;