删除后在另一个网格上调用刷新

时间:2015-01-20 18:07:17

标签: gwt smartgwt

我目前有firstGrid有一些记录,我已经在删除消息上设置了警告,因此当我单击删除按钮时会弹出一个对话框。当我在secondGrid确认删除时如何firstGrid刷新?

firstGrid.setWarnOnRemoval(true);
firstGrid.setWarnOnRemovalMessage("Delete?");

1 个答案:

答案 0 :(得分:1)

SmartGwt不支持此操作的自定义行为。你应该自己编程。

在删除操作后,只需创建一个新的ListGridField并刷新CallBack中的第二个网格。您的第一种方法可能如下:

ListGridField removeListGridField = new ListGridField("removeButton", 20);

removeListGridField.setType(ListGridFieldType.ICON);
removeListGridField.setCellIcon("[SKIN]actions/remove.png");
removeListGridField.setCanEdit(false);
removeListGridField.setCanFilter(false);
removeListGridField.setCanGroupBy(false);
removeListGridField.setCanSort(false);
removeListGridField.setCanDragResize(false);
removeListGridField.setCanFreeze(false);
removeListGridField.setCanHide(false);

removeListGridField.addRecordClickHandler(new RecordClickHandler()
{
    @Override
    public void onRecordClick(RecordClickEvent event)
    {
        if (event.getRecord() == null) // local record
            {
                discardEdits(event.getRecordNum(), 0);
                yourGrid.fetchData();
            }
            else
                removeData(event.getRecord(), new DSCallback()
                {
                    @Override
                    public void execute(DSResponse dsResponse, Object data, DSRequest dsRequest)
                    {
                        yourGrid.fetchData();
                    }
                });
    }
});