empty selection returned while selecting a complete row [message #1407535] |
Tue, 12 August 2014 21:29 |
Ralf Heydenreich Messages: 235 Registered: July 2009 |
Senior Member |
|
|
Hi all,
I've built a NatTable with several layers. I have the following stack
(only the important parts, no complete java code):
GlazedLists.eventList;
gridLayer = ListViewGridLayer (with FilterList on eventList);
tableDataLayer = gridLayer.getBodyDataLayer();
listEventLayer = new GlazedListsEventLayer<MyObject>(tableDataLayer,
eventList);
bodyLayer = new DefaultBodyLayerStack(listEventLayer);
selectionLayer = bodyLayer.getSelectionLayer();
selectionLayer.addConfiguration(new
RowOnlySelectionConfiguration<MyObject>());
RowSelectionModel<MyObject> selectionModel = new
RowSelectionModel<MyObject>(selectionLayer,
gridLayer.getBodyDataProvider(), new IRowIdAccessor<MyObject>() {
public Serializable getRowId(MyObject rowObject) {
return rowObject.getId();
}
}, false);
selectionLayer.setSelectionModel(selectionModel);
Now, if I click into the table, only the cell is selected, not the whole
row. For testing purposes I've added a natTable.addLayerListener(). This
showed me that selecting a single cell fires an event, but selecting
(marking) a whole row does nothing. Therefore the collection for the
selected objects is empty.
The goal of this exercise is simply to get the selected object
(MyObject) from the table for further using outside nattable.
What's wrong with this configuration? I tried out the
RowSelectionExample, but it didn't enlighten my mind...
TIA,
Ralf.
|
|
|
|
Re: empty selection returned while selecting a complete row [message #1407981 is a reply to message #1407683] |
Thu, 14 August 2014 00:21 |
Ralf Heydenreich Messages: 235 Registered: July 2009 |
Senior Member |
|
|
Am 13.08.2014 um 09:54 schrieb Dirk Fauth:
> I'm not sure. Maybe the default configuration must be avoided.
> But if you need the selected object, why don't you use the
> RowSelectionProvider? This way you have the same mechanism as with SWT
> default.
Ok, I've checked _5054_SelectionProviderExample once again and modified
my code according to the example. Also I used a RowSelectionProvider for
the row selection. But now, the filtering (which was working before) and
a column with icons (which was working too) are out of order. I found
out that it has to do with the CompositeLayer and its use in the
creation of NatTable. But I don't know what's wrong with this (what is,
e.g., the "setChildLayer" method for?). Maybe its only a wrong ordering
of my layers. I'd be glad if anyone could give me a hint about the
correct ordering or (the better one) a working example for this use case
(single row selection, column with an icon and filtering using a
GlazedList filter layer). And, btw., if I click on a column header, the
whole table is selected (but I think I've heard about this).
TIA,
Ralf.
|
|
|
|
Powered by
FUDForum. Page generated in 0.03115 seconds