Browse Source

Fixing logic

grid-regression-fix
Tatu Lund 5 years ago
parent
commit
8b4af0a6f2
No account linked to committer's email address
1 changed files with 3 additions and 5 deletions
  1. 3
    5
      client/src/main/java/com/vaadin/client/widgets/Grid.java

+ 3
- 5
client/src/main/java/com/vaadin/client/widgets/Grid.java View File

@@ -4155,7 +4155,6 @@ public class Grid<T> extends ResizeComposite implements HasSelectionHandlers<T>,
* on initialization, but not after that.
*/
private DataSource<T> dataSource;
private Registration dataChangeHandler;

/**
* Currently available row range in DataSource.
@@ -7034,13 +7033,12 @@ public class Grid<T> extends ResizeComposite implements HasSelectionHandlers<T>,

// Remove change handler gracefully, otherwise NPE would occur during
// datasource change and rebind
if (dataChangeHandler != null) {
dataChangeHandler.remove();
dataChangeHandler = null;
if (this.dataSource != null) {
this.dataSource.setDataChangeHandler(null);
}

this.dataSource = dataSource;
dataChangeHandler = dataSource.setDataChangeHandler(new DataChangeHandler()) {
dataSource.setDataChangeHandler(new DataChangeHandler() {
@Override
public void dataUpdated(int firstIndex, int numberOfItems) {
escalator.getBody().refreshRows(firstIndex, numberOfItems);

Loading…
Cancel
Save