Single click sorting doesn't work anymore [message #1464746] |
Fri, 07 November 2014 21:01 |
Thomas Zwickl Messages: 37 Registered: May 2014 |
Member |
|
|
I've reconfigured my nattable to meet our new requirements and although I haven't changed anything on the NatTable itself, I added only a few new layers, I cannot sort the rows anymore with a single click in the column header.
I still have the following line in my code which just adds the SingleClickSortConfiguration to the NatTable:
natTable.addConfiguration(new SingleClickSortConfiguration());
But when I click into the header absolutely nothing happens. It just seems as there wouldn't be any button at all. Before this change it worked perfectly, but now after adding a few more layers it won't.
Here some code from my configuration:
Creating the filter list and the sort list:
FilterList<T> filterList = new FilterList<T>(eventList);
SortedList<T> sortedList = new SortedList<T>(filterList, null);
ColumnGroupModel columnGroupModel = new ColumnGroupModel();
final IDataProvider columnHeaderDataProvider = this.createColumnHeaderDataProvider(columnPropertyAccessor);
My body layer:
bodyDataProvider = new GlazedListsDataProvider<T>(eventList, columnPropertyAccessor);
bodyDataLayer = new DataLayer(bodyDataProvider);
glazedListsEventLayer = new GlazedListsEventLayer<T>(bodyDataLayer, eventList);
columnReorderLayer = new ColumnReorderLayer(glazedListsEventLayer);
columnGroupReorderLayer = new ColumnGroupReorderLayer(columnReorderLayer, columnGroupModel);
columnHideShowLayer = new ColumnHideShowLayer(columnGroupReorderLayer);
columnGroupExpandCollapseLayer = new ColumnGroupExpandCollapseLayer(columnHideShowLayer, columnGroupModel);
selectionLayer = new SelectionLayer(columnGroupExpandCollapseLayer);
viewportLayer = new ViewportLayer(selectionLayer);
freezeLayer = new FreezeLayer(selectionLayer);
compositeFreezeLayer = new CompositeFreezeLayer(freezeLayer, viewportLayer, selectionLayer);
setUnderlyingLayer(compositeFreezeLayer);
My column header:
columnHeaderDataProvider = dataProvider;
columnHeaderDataLayer = new DefaultColumnHeaderDataLayer(columnHeaderDataProvider);
columnHeaderLayer = new ColumnHeaderLayer(columnHeaderDataLayer, bodyLayer, selectionLayer);
SortHeaderLayer<T> sortHeaderLayer = new SortHeaderLayer<T>(columnHeaderLayer, new GlazedListsSortModel<T>(
sortedList, columnPropertyAccessor, configRegistry, columnHeaderDataLayer), false);
columnGroupHeaderLayer = new ColumnGroupHeaderLayer(sortHeaderLayer, selectionLayer, columnGroupModel);
CompositeMatcherEditor<T> autoFilterMatcherEditor = new CompositeMatcherEditor<T>();
filterList.setMatcherEditor(autoFilterMatcherEditor);
FilterRowHeaderComposite<T> composite = new FilterRowHeaderComposite<T>(
new DefaultGlazedListsFilterStrategy<T>(autoFilterMatcherEditor, columnPropertyAccessor, configRegistry),
columnGroupHeaderLayer, columnHeaderDataProvider, configRegistry);
setUnderlyingLayer(composite);
Then I create my row header and corner and add this all into a grid layer
// Row header
DefaultRowHeaderDataProvider rowHeaderDataProvider = new DefaultRowHeaderDataProvider(bodyDataProvider);
DefaultRowHeaderDataLayer rowHeaderDataLayer = new DefaultRowHeaderDataLayer(rowHeaderDataProvider);
RowHeaderLayer rowHeaderLayer = new RowHeaderLayer(rowHeaderDataLayer, bodyLayer, bodyLayer.getSelectionLayer());
// Corner
DefaultCornerDataProvider cornerDataProvider = new DefaultCornerDataProvider(
columnHeaderLayerStack.getColumnHeaderDataProvider(), rowHeaderDataProvider);
DataLayer cornerDataLayer = new DataLayer(cornerDataProvider);
CornerLayer cornerLayer = new CornerLayer(cornerDataLayer, rowHeaderLayer, columnHeaderLayerStack);
// Grid
gridLayer = new GridLayer(bodyLayer, columnHeaderLayerStack, rowHeaderLayer, cornerLayer, useDefaultConfiguration);
// add editing handler for filter
gridLayer.addConfiguration(new DefaultEditConfiguration());
At last I create my NatTable:
natTable = new NatTable(parent, gridLayer, false);
natTable.setConfigRegistry(configRegistry);
...
Lot of other code for formatting the NatTable and adding a custom popup menu
...
natTable.addConfiguration(new SingleClickSortConfiguration());
natTable.configure();
Any ideas where the problem could be?
[Updated on: Sat, 08 November 2014 03:33] Report message to a moderator
|
|
|
|
|
|
Re: Single click sorting doesn't work anymore [message #1465523 is a reply to message #1465162] |
Sat, 08 November 2014 12:25 |
Thomas Zwickl Messages: 37 Registered: May 2014 |
Member |
|
|
OK I could now narrow down the problem to the following two lines:
// create persistence dialog
DisplayPersistenceDialogCommandHandler persistenceDialogHandler = new DisplayPersistenceDialogCommandHandler(natTable);
glazedListsGridLayer.getBodyLayer().registerCommandHandler(persistenceDialogHandler);
When I call these lines before I call natTable.configure() my single click sorting won't work, but when I move these two lines behind the natTable.configure() everything works fine. I haven't figured out what the reason is for that behaviour but maybe one of you knows what's the problem here.
[Updated on: Sat, 08 November 2014 12:28] Report message to a moderator
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.04994 seconds