Eclipse Community Forums - RDF feed
https://www.eclipse.org/forums/
Eclipse Community Forumsdelete row
https://www.eclipse.org/forums/index.php/mv/msg/452657/1007517/#msg_1007517
I want to delete a selected row in the table.
The selected row position is available from the selection layer.
bodyLayer.getSelectionLayer().getSelectedRowPositions()
My underlying data model is based on emf.
What is the best way to delete the row?
I am able to delete the object in the emf based model by the selected row index. But then I need to
redraw the natTable. And the redraw does not work well. Some times it redraws and some times all
table entries are invisible.
Is there a way to delete a row which better fits into the natTable concept?
Any hints are appreciated, Martin]]>Martin Jacob2013-02-06T10:07:10-00:00Re: delete row
https://www.eclipse.org/forums/index.php/mv/msg/452657/1007527/#msg_1007527
I have to admit that getting familiar with EMF based data models for NatTable is still on my ToDo list.
I implemented a delete row functionality in a customer project. But there I used GlazedLists and the GlazedListsEventLayer, so removing an item from the eventList did the trick.
So far I created a DeleteRowCommand and the corresponding DeleteRowCommandHandler which I registered for the GridLayer. Determining the rows to delete I did similar to your approach.
Now the question is, why is the redraw behaving the way you describe it. And how do you redraw the NatTable? Do you call redraw()? Well this is not the way it would work. You will need to either fire a RowStructuralRefreshEvent (look at the GlazedListsEventLayer for an example) or call NatTable.refresh() which does a complete refresh.
You need to know that events in NatTable are fired the layer stack upwards. This means, if you would like to fire a RowStructuralRefreshEvent on deleting a row, you should think about registering the command handler to the data layer , so every other layer gets informed about the deleted row.
Hope that helps,
Dirk]]>Dirk Fauth2013-02-06T10:33:02-00:00Re: delete row
https://www.eclipse.org/forums/index.php/mv/msg/452657/1007553/#msg_1007553
https://bugs.eclipse.org/bugs/show_bug.cgi?id=383056 ]]>Thomas Mäder2013-02-06T12:44:33-00:00Re: delete row
https://www.eclipse.org/forums/index.php/mv/msg/452657/1007555/#msg_1007555
the problem is solved in the following way:
1.) Delete the model objects in the EMF model.
2.) Listen to the EMF command stack and refresh the table
schrieb Dirk Fauth, Am 06.02.2013 11:33:
> Hi,
>
> I have to admit that getting familiar with EMF based data models for NatTable is still on my ToDo list.
>
> I implemented a delete row functionality in a customer project. But there I used GlazedLists and the
> GlazedListsEventLayer, so removing an item from the eventList did the trick.
> So far I created a DeleteRowCommand and the corresponding DeleteRowCommandHandler which I registered
> for the GridLayer. Determining the rows to delete I did similar to your approach.
> Now the question is, why is the redraw behaving the way you describe it. And how do you redraw the
> NatTable? Do you call redraw()? Well this is not the way it would work. You will need to either fire
> a RowStructuralRefreshEvent (look at the GlazedListsEventLayer for an example) or call
> NatTable.refresh() which does a complete refresh.
>
> You need to know that events in NatTable are fired the layer stack upwards. This means, if you would
> like to fire a RowStructuralRefreshEvent on deleting a row, you should think about registering the
> command handler to the data layer , so every other layer gets informed about the deleted row.
>
> Hope that helps,
> Dirk]]>Martin Jacob2013-02-06T12:55:44-00:00