添加按钮,GXT网格细胞 [英] Adding button to the GXT Grid cell

查看:108
本文介绍了添加按钮,GXT网格细胞的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用GXT 2.2.0,我需要做一个按钮删除行。这是一个想法,使复选框,并创建一个按钮,删除,但我已经有复选框用户选择行进一步使用它们,决定了它是不是用户友好。那么如何添加按钮,将电池?

I use GXT 2.2.0 and I need to make a button for deleting rows. It was an idea to make checkboxes and create a button "delete", but I already have checkbox for choosing rows by users to use them further and decided it is not "user-friendly". So how to add button to the cell?

推荐答案

将按钮添加到细胞,我不得不这样做:

to add the button to the cell I had to do this:

        column = new ColumnConfig();
        column.setRenderer(new GridCellRenderer() {
            @Override
            public Object render(ModelData model, String property, ColumnData config,                      int rowIndex, int colIndex, ListStore store, Grid grid) {

                final int row = store.indexOf((PropertyItem) model);

                Button b = new Button("remove", new SelectionListener<ButtonEvent>() {
                    @Override
                    public void componentSelected(ButtonEvent ce) {
                        Window.alert("row index= " + row);
                        remove(row, customerId);
                    }
                });

                b.setIconStyle("/gxt/images/gxt/icons/delete.png");
                return b;
            }
        });

这篇关于添加按钮,GXT网格细胞的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆