Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

gridpanel key navigation on load

I have a grid panel used for searching items. It starts out empty but it's configured store loads whenever a user triggers a nearby searchfield.

I'm using grid.getSelectionModel().select(0) to select the first row when it loads. But this doesn't enable key navigation with the arrow keys afterwards. If I perform a mousedown on a row then the arrow key navigation will work.

I would like to just automatically select the first record and have the arrow key navigation enabled.

I've tried focusing on the grid, the gridview and also the first row with grid.view.focusRow(0) and I've tried all of these before and after calling select(0). None of these give me key navigation. Any ideas?

This is using 4.1b2

like image 960
egerardus Avatar asked Jan 20 '26 00:01

egerardus


1 Answers

ExtJs4 have special singleton class for focus management. It calls with:

Ext.FocusManager.enable({focusFrame: true});

Just put this after Ext loading, and you with see highlighted component which have focus in present. So, you was very close to make it working, I tested and it works in my application

grid.getView().focus();
grid.getSelectionModel().select(0);

p.s. Please be sure that you have more than 0 records in your store.

like image 173
Rustem Avatar answered Jan 22 '26 17:01

Rustem



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!