PDA

View Full Version : problem with livegrid, when you use the keyboard a lot



domfr
14 Jun 2017, 1:33 AM
Hi,

I found a problem with livegrid. Sometimes, when you use the keyboard a lot to navigate a grid, there is a loss of focus.

To reproduce the problem :

- http://examples.sencha.com/gxt/4.0.2/#ExamplePlace:livegrid
- keep pressed arrow down key, long time
- keep pressed arrow up key, long time
- the widget will lose focus...

And if you insist, sometimes you get a javascript exception : "Error: Exception caught; (TypeError) : Cannot read property 'c' of null".

Dominique.

domfr
15 Jun 2017, 12:10 AM
A example of this exception with Chrome Version 58.0.3029.110 (64-bit) :

56445

branflake2267
19 Jun 2017, 6:04 AM
I'm looking into why this is happening and will get back to you.

Thanks,
Brandon

branflake2267
20 Jun 2017, 1:47 PM
I've found the issue. Turns out when the loader fires to load the page when navigating up, the offset is off by one, and the row is removed and focus is lost to the outer element, the body. I won't have time to fix it today and find a better workaround, but I have found something that may work for you in the mean time. After vacation I can take a better look at this and fix it.

If I add a load handler and after the load focus on the first row, you can page up. But you'll notice you'll be one behind.




pagingLoader.addLoadHandler(new LoadHandler<FilterPagingLoadConfig, PagingLoadResult<Data>>() {
@Override
public void onLoad(LoadEvent<FilterPagingLoadConfig, PagingLoadResult<Data>> event) {
if (beforeSelected != null) {
//grid.getSelectionModel().select(beforeSelected, false);
int index = grid.getStore().indexOf(beforeSelected);
//grid.getSelectionModel().select(index, false);

GWT.log("\t\t @@@@@@@@@ after load " + index);

Timer t = new Timer() {
@Override
public void run() {
grid.getView().focusCell(0, 0, false);
GWT.log("\t\t @@@@@@@@@ AFTER ");
}
};
t.schedule(500);
}
});

branflake2267
20 Jun 2017, 1:48 PM
Oops I forgot a piece. I sued a before handler too.



pagingLoader.addBeforeLoadHandler(new BeforeLoadHandler<FilterPagingLoadConfig>() {
@Override
public void onBeforeLoad(BeforeLoadEvent<FilterPagingLoadConfig> event) {
beforeSelected = grid.getSelectionModel().getSelectedItem();


GWT.log("\t\t ######### before load " + beforeSelected);
}
});


pagingLoader.addLoadHandler(new LoadHandler<FilterPagingLoadConfig, PagingLoadResult<Data>>() {
@Override
public void onLoad(LoadEvent<FilterPagingLoadConfig, PagingLoadResult<Data>> event) {
if (beforeSelected != null) {
//grid.getSelectionModel().select(beforeSelected, false);
int index = grid.getStore().indexOf(beforeSelected);
//grid.getSelectionModel().select(index, false);

GWT.log("\t\t @@@@@@@@@ after load " + index);

Timer t = new Timer() {
@Override
public void run() {
grid.getView().focusCell(0, 0, false);
GWT.log("\t\t @@@@@@@@@ AFTER ");
}
};
t.schedule(500);
}


}
});

domfr
22 Jun 2017, 6:38 AM
Thank you for this response and workaround. At this time, our product is not released yet, so we will wait for official fix. Good vacation.

Regards,
Dominique.