2016-10-13 81 views

回答

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(); 
} 
+0

在impl類中的getcountrows方法 – keval

+0

兩個答案都附上了。錯誤我發佈了不完整的答案。 – keval

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 =「#{backinbean.styleforcell }「