boatcoder
boatcoder

Reputation: 18107

Select a row in extjs grid without moving the focus to that grid

I have a form that needs to be filled out based upon 2 or more images. The form is on the bottom of page (SOUTH) and there is list of images on the left hand side, and the center pane displays the images.

I'm trying to use the keyboard to change the image displayed while I'm in an edit field using Shift-PageUp/Shift-PageDown.

All of that is working except, when I do

images.getSelectionModel().selectPrevious(false);  

the focus leaves the input field and moves to the grid. I need the select event to propagate, so I can display the new image from the list, but I would like NOT steal the focus from the input field.

I don't see anyway to select the row in the grid and leave the screen focus where it is. Is there someway to do this?

http://docs.extjs.com/extjs/4.2.1/#!/api/Ext.selection.RowModel-method-selectNext

I don't see it if there is. 4.2.1

Upvotes: 1

Views: 3873

Answers (3)

squirrel
squirrel

Reputation: 203

There is also hidden preventFocus property on the selection model. This should raise the select event, but do not set the focus.

http://docs.sencha.com/extjs/4.2.1/source/Model2.html#Ext-selection-Model-method-doSingleSelect

Upvotes: 1

squirrel
squirrel

Reputation: 203

Try to set the suppressEvent arg to true (second one)

http://docs.sencha.com/extjs/4.2.1/#!/api/Ext.selection.RowModel-method-selectPrevious

Upvotes: 0

SW4
SW4

Reputation: 71150

One solution would be a bit of a work around but should do the trick. In whatever event kicks off the grid selection, select the rows you want then return focus to the field in question using:

myField.focus()

or

this.focus()

Upvotes: 0

Related Questions