如何动态更新单元格表格页脚

我试图添加页脚到celltable并找到动态更改celltable页脚的困难时间,但我可以在创建如下列的列时添加

cellTable.addColumn(qty, "Qty",Integer.toString(totalQty)); 

这不是我要找的,有没有办法动态设置页脚到单元格表。有什么帮助吗?

采纳答案:

您需要实现自定义标头并将其添加到应包含该页脚的列。 例如:

public class QuantityFooter extends Header<Number> {

    private final Number totalQty;

    public QuantityFooter(Number totalQty) {
        super(new NumberCell());
        this.totalQty = totalQty;
    }

    public void setQuantity(Number totalQty) {
        this.totalQty = totalQty;
    }

    @Override
    public Number getValue() {
        return totalQty;
    }
}

然后将其添加到列:

QuantityFooter quantityFooter = new QuantityFooter(0);
cellTable.addColumn(qty, new TextHeader("Qty"),quantityFooter ); 

当你需要更新页脚时,你只需要调用quantityFooter.setQuantity(10) ,你可能需要用redrawHeader()redrawFooters()重绘页眉/页脚。

author: Ümit

参考更多解答: How to Update Cell Table Footer Dynamically ,转载请保留出处如何动态更新单元格表格页脚及作者信息

Statement: We respect knowledge and authors. Since the content comes from the Internet and is intended for scientific research, any reprinters should retain the author's signature and origin. If you are the author of the content and feel in dispute, please contact email: 1076545519@qq.com. We will find out the situation and deal with it in time. We sincerely thank the author for his hard work.


更多:gwt-celltable