如何在运行时使用RowInsertEvent在Nattable中插入新行?

时间:2016-02-09 12:20:44

标签: nattable

我认为解决方案就像那个答案 Delete rows from Nattable 但我无法编辑doCommand为需要插入的对象添加一个参数,因为doCommand是一种覆盖方法

public boolean doCommand(ILayer targetLayer, AddRowCommand command) {

            //convert the transported position to the target layer
            if (command.convertToTargetLayer(targetLayer)) {
                //remove the element
                this.bodyData.remove(command.getRowPosition());
                //fire the event to refresh
                targetLayer.fireLayerEvent(new RowInsertEvent(targetLayer, command.getRowPosition()));
                return true;
            }
            return false;
        }

1 个答案:

答案 0 :(得分:0)

您不必修改doCommand()。您需要修改AddRowCommand以传输要添加的对象。