PDA

View Full Version : Selecting Item in List



steve7516
27 Jul 2011, 1:44 PM
I am trying to select and scroll to an item in a List, but I cannot get it to work. I have tried several methods including this http://www.sencha.com/forum/showthread.php?106824-Scroll-to-an-selected-Item-in-a-List

my current code is for this portion is



this.teamList.scroller.scrollTo({x:0,y:0},false);
var listId = this.TeamStore.find('id',record.data.id);
this.teamList.select(listId);
var ehtml = this.teamList.getNode(listId);
var el = Ext.get(ehtml);
var xcoord = el.getY()-this.teamList.getHeight();
var ycoord = el.getX();
this.teamList.scroller.scrollTo({x:xcoord,y:ycoord},true);


In this code, record.data.id is valid, and listId is set to the correct value. However teamList.select() has the error: Uncaught TypeError: Cannot call method 'addCls' of null
getNode returns an undefined object.

Is there something wrong with using select() on a list object?

bharatn
27 Jul 2011, 2:58 PM
I tried out List.select and it works fine. Are you using the latest version 1.1?

steve7516
27 Jul 2011, 3:15 PM
Yes, I am.
Is there any way that select could return an error on a valid store id returned by store.find()?