PDA

View Full Version : Selecting a List item programmatically



naderc
15 Aug 2011, 12:32 PM
Hello,

I am trying to get the first item of an Ext.List to be selected automatically whenever the list is loaded. The following does not seem to work:

list.getSelectionModel().select(0, false, true);

What am I missing?

Thank you for your help,

Nader

naderc
17 Aug 2011, 9:45 AM
I ended up figuring out the answer on my own by going through the sencha touch framework code.
I added the following code to the initComponent function of my Panel:

this.mon(this.myList.store, {
load: function() {
this.myList.getSelectionModel().select(0, false, true);
},
scope: this
});

Hope this helps someone else.

Nader