Skip to content
This repository has been archived by the owner on Oct 4, 2023. It is now read-only.

Commit

Permalink
refs tsuoanttila#34 : TableSelectionModel - shift-select does not loo…
Browse files Browse the repository at this point in the history
…se first selected items anymore.
  • Loading branch information
alexandru78 committed Jan 21, 2020
1 parent afcbb92 commit 4c2a5ef
Showing 1 changed file with 8 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,14 @@
* <p>
* This is a SelectionModel for SelectGrid, use
* {@link SelectGrid#setSelectionModel(GridSelectionModel)} to take it into use.
*
*
* @author Teemu Suo-Anttila
*/
public class TableSelectionModel<T> extends MultiSelectionModelImpl<T> {

/**
* Set the TableSelectionMode to use with this extension.
*
*
* @param mode
* table-like selection mode
*/
Expand Down Expand Up @@ -67,14 +67,17 @@ public void selectRange(int start, int length) {
*/
return comparator1.thenComparing(comparator2)::compare;
};
Comparator<T> inMemorySorting = getParent().getSortOrder().stream()
final Grid<T> grid = getParent();
Comparator<T> inMemorySorting = grid.getSortOrder().stream()
.map(order -> order.getSorted().getComparator(order.getDirection()))
.reduce((x, y) -> 0, operator);

List<QuerySortOrder> sortProperties = new ArrayList<>();
getParent().getSortOrder().stream().map(order -> order.getSorted().getSortOrder(order.getDirection()))
grid.getSortOrder().stream().map(order -> order.getSorted().getSortOrder(order.getDirection()))
.forEach(s -> s.forEach(sortProperties::add));
getParent().getDataProvider().fetch(new Query<>(start, length, sortProperties, inMemorySorting, null));
grid.getDataProvider().fetch(new Query<>(start, length, sortProperties, inMemorySorting, null))
.forEach(grid::select);

}
});
}
Expand Down

0 comments on commit 4c2a5ef

Please sign in to comment.