Hi, i'm experimenting with a new search feature in a grid.
For reasons, we only show records in a grid that matches a certain criteria, say "banana" should be true.
we then have a button that triggers the criteria between true and false, and reload records from the server matching this criteria.
This is how we do it:
I have then added a onDataArrivedHandler to the grid:
The issue we have is that the *first* time we flip the criteria and invalidate the cache, i get two calls, one with 0, 0 and then the one with the correct amounts of row from the server.
Example of log output when we click the button a few times:
The server is only called once each time, also the first.
What is that first onDataArrived call? I would like it to not happen. It does not represent any data that has arrived :)
For reasons, we only show records in a grid that matches a certain criteria, say "banana" should be true.
we then have a button that triggers the criteria between true and false, and reload records from the server matching this criteria.
This is how we do it:
Code:
public void handleFlipButton() { //sets banana = true or false grid.setCriteria(getCriteriaForCurrent()); grid.invalidateCache(); }
Code:
@Override public void onDataArrived(DataArrivedEvent dataArrivedEvent) { GWT.log("onDataArrived, start:" + dataArrivedEvent.getStartRow() + ", end: " + dataArrivedEvent.getEndRow()); }
The issue we have is that the *first* time we flip the criteria and invalidate the cache, i get two calls, one with 0, 0 and then the one with the correct amounts of row from the server.
Example of log output when we click the button a few times:
first call to handleFlipButton:
onDataArrived, start:0, end: 0
onDataArrived, start:0, end: 10
second, third, fourth
onDataArrived, start:0, end: 17
onDataArrived, start:0, end: 10
onDataArrived, start:0, end: 17
onDataArrived, start:0, end: 0
onDataArrived, start:0, end: 10
second, third, fourth
onDataArrived, start:0, end: 17
onDataArrived, start:0, end: 10
onDataArrived, start:0, end: 17
The server is only called once each time, also the first.
What is that first onDataArrived call? I would like it to not happen. It does not represent any data that has arrived :)
Comment