Delete rows from Nattable

后端 未结 2 1590
佛祖请我去吃肉
佛祖请我去吃肉 2020-12-21 21:30

I want to implement a row deletion logic in a Nebula Nattable. This is what I plan to do:

  1. Add context menu to the Nattable which is described in http://blog.v
2条回答
  •  一整个雨季
    2020-12-21 22:19

    In our application we do the following:

    1. Get selected row objects:

      SelectionLayer selectionLayer = body.getSelectionLayer();
      int[] selectedRowPositions = selectionLayer.getFullySelectedRowPositions();
      Vector rowObjectsToRemove = new Vector();
      
      for (int rowPosition : selectedRowPositions) {
          int rowIndex = selectionLayer.getRowIndexByPosition(rowPosition);
          rowObjectsToRemove .add(listDataProvider.getRowObject(rowIndex));
      }
      
    2. Remove them from the data provider

    3. call natTable.refresh()

提交回复
热议问题