Simple task but gave me a lot of pain. When selection works fine - view.focusRow() or view.focusNode() is a killer. I ended up doing this, where focusOnSelect is a function of .mon
Rows are selected but not focused without DelayedTask.
I would appreciate any suggestions to simplify this if possible.

PS. Just to clarify, I first create window with empty grid. Than I call store.loadData().

This is a first thing I tried because it is easiest. But didnt work for me.

First, when you pass array of indexes into selectionModel.select () it doesnt select. Either one-by-one with indexes or array of model objects.
Second, it doesnt focus. As soon as I use delayed task everything works.

metalinspired

21 Sep 2012, 5:26 AM

You're right about select().
Simple for() loop will suffice but add third param as true to suppress events.
I don't know why focus() doesn't work because I'm using exact code that I pasted, in one of my apps, and if works just fine.

whalethewise

21 Sep 2012, 5:43 AM

focus works fine when I have Grid generated and loaded . And when after that I come and do focusRow() - no problem. But during loadData - I have a problem.

So I ended up doing following:
I mon() to 'datachanged' event where I do selection.
And I mon() with delay to view 'refresh' event where I do focus.