|
|
Re: Update column comparators after column reorder [message #1714851 is a reply to message #1714798] |
Tue, 17 November 2015 09:41 |
Tommy R Messages: 32 Registered: October 2011 Location: Hamburg |
Member |
|
|
Hello Dirk, thanks for your answer.
I already add the labels to the DataLayer of the column header. Here is how my ColumnHeaderLayerStack (shortened) looks like:
IDataProvider headerDataProvider = new ColumnHeaderDataProvider();
DataLayer columnHeaderDataLayer = new DataLayer(headerDataProvider);
// enable sorting
ColumnOverrideLabelAccumulator labelAccumulator = new ColumnOverrideLabelAccumulator(columnHeaderDataLayer);
columnHeaderDataLayer.setConfigLabelAccumulator(labelAccumulator);
for (int i = 0; i < getColumns().size(); i++) {
labelAccumulator.registerColumnOverrides(i, ColumnComparator.CUSTOM_COMPARATOR_LABEL);
}
configRegistry.registerConfigAttribute(SortConfigAttributes.SORT_COMPARATOR, new ColumnComparator(),
DisplayMode.NORMAL, ColumnComparator.CUSTOM_COMPARATOR_LABEL);
ILayer columnHeaderLayer = new ColumnHeaderLayer(columnHeaderDataLayer, bodyLayer, bodyLayer.getSelectionLayer());
SortHeaderLayer<IGeoDataRow> sortHeaderLayer = new SortHeaderLayer<>(
columnHeaderLayer,
new GlazedListsSortModel<>(sortedList, columnPropertyAccessor, configRegistry, columnHeaderDataLayer),
false);
setUnderlyingLayer(sortHeaderLayer);
Am I doing something wrong here?
|
|
|
|
|
Re: Update column comparators after column reorder [message #1714909 is a reply to message #1714876] |
Tue, 17 November 2015 16:06 |
Tommy R Messages: 32 Registered: October 2011 Location: Hamburg |
Member |
|
|
Ok I guess the actual problem is, that I use my own ColumnReorderCommandHandler to update the model. So when I call ColumnReorderCommand within my handler the comparators seem to be switched correctly. But when it tries to redraw the table it gets a problem with my CellPainters as it seems to check an old model (the one before the DnD). So in the example of my first post it tries to paint for Integer values when the column is still Boolean.
But I guess I got a conceptual problem here. The more I learn abot NatTable the more I think: Why do I have to write my own ColumnReorderCommandHandler to update my model? Shouldn't the NatTable be able to update it for me via some mechanism?
So I thought that might be the setDataValue method in my ColumnPropertyAccessor. But this method never gets called.
So what would be the right way to update the model after/While DnD?
Maybe some words about my model:
My model also looks like a table, so it got rows and columns and when I reorder columns in the NatTable I also have to reorder them in my table model.
[Updated on: Tue, 17 November 2015 16:08] Report message to a moderator
|
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.03217 seconds