PDA

View Full Version : select() in DataView



piccard
20 May 2014, 3:24 AM
Hi,
I have a DataView and I want to preselect an item afterr rendering.


// XTemplate for the Dataview
var tpl = new Ext.XTemplate(
'<tpl for=".">',
'<a href="#" class="noBorderPlease">',
'<div class="storageNavi">',
'<span class="{cssClass}"></span>',
'<span>{name}</span>',
' </div>',
'</a>',
'</tpl>'
);

var westPanel = new Ext.DataView({
autoScroll : true,
tpl : tpl,
id : 'westPanel',
store : menuStore,
singleSelect: true,
itemSelector: 'div.storageNavi',
selectedClass: 'menuItemSelected',
overClass : 'menuItemOver',
listeners: {
scope: this,
click: function ( dv, index, node, e ) {
centerPanel.layout.setActiveItem(dv.getSelectedIndexes()[0]);

},
afterrender: function(dv) {
dv.select(dv.store.getAt(2));
}

} // listeners
}); // DataView

Unfortunatly I cannot preselect the third item in the DataView. Any ideas?
thank you :-)

piccard
20 May 2014, 3:59 AM
ok ... solved. Just moved the listener in the parent panel ... works :-)