Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/361.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/gwt/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/cassandra/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java 如何在GXT 2.2网格中添加图像作为单元格背景_Java_Gxt - Fatal编程技术网

Java 如何在GXT 2.2网格中添加图像作为单元格背景

Java 如何在GXT 2.2网格中添加图像作为单元格背景,java,gxt,Java,Gxt,我想将按钮添加到单元格中,但现在我只准备为单元格的背景设置一个图像,然后处理单击。如何将图像添加到单元格?无需手动添加已存在图像 好好利用它 您甚至可以通过进行添加。无需手动添加,因为已经有 好好利用它 如果要渲染列中的按钮,请参见setRenderer的ColumnConfig方法 以下内容将在网格的每一行上设置一个按钮: ColumnConfig cfg = new ColumnConfig(); cfg.setRenderer(new GridCellRenderer() { @O

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

无需手动添加已存在图像

好好利用它


您甚至可以通过进行添加。

无需手动添加,因为已经有

好好利用它


如果要渲染列中的按钮,请参见
setRenderer
ColumnConfig
方法

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

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;
    }
}):
ColumnConfig cfg=new ColumnConfig();
setRenderer(新的GridCellRenderer(){
@凌驾
公共对象渲染(M模型、字符串属性、,
ColumnData配置、int行索引、int colIndex、,
ListStore存储,网格){
按钮按钮=新按钮();
//基于此渲染函数的参数设置按钮
//例如,“model”参数是支持每行的项。
//将为网格中的每一行调用此渲染方法
//看http://dev.sencha.com/deploy/gxt-2.2.5/docs/api/com/extjs/gxt/ui/client/widget/grid/GridCellRenderer.html
返回按钮;
}
}):

如果要渲染列中的按钮,请参见
setRenderer
方法
ColumnConfig

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

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;
    }
}):
ColumnConfig cfg=new ColumnConfig();
setRenderer(新的GridCellRenderer(){
@凌驾
公共对象渲染(M模型、字符串属性、,
ColumnData配置、int行索引、int colIndex、,
ListStore存储,网格){
按钮按钮=新按钮();
//基于此渲染函数的参数设置按钮
//例如,“model”参数是支持每行的项。
//将为网格中的每一行调用此渲染方法
//看http://dev.sencha.com/deploy/gxt-2.2.5/docs/api/com/extjs/gxt/ui/client/widget/grid/GridCellRenderer.html
返回按钮;
}
}):

不幸的是,所有项目都在第二个GXT上,我不能仅仅因为一个按钮就将其更改为第三个;幸运的是,所有项目都在第二个GXT上,我不能仅仅因为一个按钮就将其更改为第三个