目前,当我在扩展VLayout
的面板上编辑记录时,双击该字段,更改文本,然后按Enter保存我的编辑。新编辑的记录显示为独立记录,而我刚编辑的记录仍然存在。
有没有办法删除旧记录?
myForm.getDataSource().updateData(currentRecord, new DSCallback()
{
@Override
public void execute(DSResponse response, Object rawData, DSRequest request)
{
window.hide();
}
});
答案 0 :(得分:0)
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();
}
});
}
});
查看此代码可以帮助您。