gpt4 book ai didi

java - 如何添加图像作为 GXT 2.2 网格中单元格的背景

转载 作者:行者123 更新时间:2023-12-01 23:45:15 25 4
gpt4 key购买 nike

我想将按钮添加到单元格,但现在我准备好为单元格背景设置图像,然后处理单击。如何将图像添加到单元格中?

最佳答案

如果要在列中渲染按钮,请参阅ColumnConfigsetRenderer方法。

以下将在网格的每一行上设置一个按钮:

ColumnConfig cfg = new ColumnConfig();
cfg.setRenderer(new GridCellRenderer() {
@Override
public Object render(M model, String property,
ColumnData config, int rowIndex, int colIndex,
ListStore<M> store, Grid<M> grid) {
Button button = new Button();
// set up button based on params to this render function
// for example, the `model` argument is the item backing each row.
// this render method is called for each row in the grid
// see http://dev.sencha.com/deploy/gxt-2.2.5/docs/api/com/extjs/gxt/ui/client/widget/grid/GridCellRenderer.html
return button;
}
}):

关于java - 如何添加图像作为 GXT 2.2 网格中单元格的背景,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17191324/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com