2014-02-09 29 views

回答

0

不要使用celltable,但custome CellList,將被罰款

public class HorizontalCellList<T> extends CellList<T> { 

    public HorizontalCellList(Cell<T> cell) { 
    super(cell); 
    } 

    @Override 
    protected void renderRowValues(
     SafeHtmlBuilder sb, List<T> values, int start, SelectionModel<? super T> selectionModel) { 
    SafeHtmlBuilder filteredSB = new SafeHtmlBuilder(); 
    super.renderRowValues(filteredSB, values, start, selectionModel); 
    SafeHtml safeHtml = filteredSB.toSafeHtml(); 
    String filtered = safeHtml.asString().replaceAll("<div", "<span").replaceAll("div>","span>"); 
    sb.append(SafeHtmlUtils.fromTrustedString(filtered)); 
    } 
} 
+1

的字符串替換爲更改爲內聯元素稍微可怕的方式 - 而不是考慮使用CSS是調整那些特定的div元素(由他們的類,可能不是)「display:inline」或「float:left」,而不是用* regex *重寫* html *。 –

+0

你有沒有測試你的代碼?我試過{.horizo​​ntalCellList { display:inline; }但它不工作?你能提供你的代碼嗎? – Tum

+0

不要將其應用於整個單元格列表 - 將其應用於單元格本身。爲了使CellList能夠與它一起工作,你需要構建一個擴展CellList自己的clientbundle的clientbundle,並且添加更多的css(可能在'.cellListEvenItem'和'.cellListOddItem'樣式中,因爲沒有其他樣式被添加到項目本身)。 –

相關問題