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?
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试):
问题:
回答1:
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;
}
});